Introduce propertyDelegated method in delegates

This commit is contained in:
Denis Mekhanikov
2014-09-20 17:42:02 +04:00
parent 9e38d207f2
commit c4bfa0edca
35 changed files with 597 additions and 42 deletions
@@ -0,0 +1,15 @@
class Delegate {
var name = ""
fun get(t: Any?, p: PropertyMetadata): String = name
fun propertyDelegated(p: PropertyMetadata) { name = p.name }
}
fun foo() = Delegate()
class A {
val prop by foo()
}
fun box(): String {
return if (A().prop == "prop") "OK" else "fail"
}