Generate bytecode for delegated properties

This commit is contained in:
Natalia.Ukhorskaya
2013-04-22 13:59:37 +04:00
parent 3297c0e9d3
commit 6e2584d0de
33 changed files with 731 additions and 50 deletions
@@ -0,0 +1,20 @@
class Delegate<T>(val f: (T) -> Int) {
fun get(t: T, p: String): Int = f(t)
}
val p = Delegate<A> { t -> t.foo() }
class A(val i: Int) {
val prop: Int by p
fun foo(): Int {
return i
}
}
fun box(): String {
if(A(1).prop != 1) return "fail get1"
if(A(10).prop != 10) return "fail get2"
return "OK"
}