Introduce propertyDelegated method in delegates
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
class Delegate {
|
||||
var name = ""
|
||||
fun get(t: Any?, p: PropertyMetadata): String = name
|
||||
}
|
||||
|
||||
fun Delegate.propertyDelegated(p: PropertyMetadata) { name = p.name }
|
||||
|
||||
class A {
|
||||
val prop by Delegate()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return if (A().prop == "prop") "OK" else "fail"
|
||||
}
|
||||
Reference in New Issue
Block a user