Delegated Properties: Code generation for local properties (JVM)

This commit is contained in:
Dotlin
2015-09-30 02:33:45 +03:00
committed by Mikhael Bogdanov
parent fa523b9af4
commit 4c223845b6
22 changed files with 563 additions and 78 deletions
@@ -0,0 +1,14 @@
package foo
import kotlin.reflect.KProperty
fun <T> run(f: () -> T) = f()
class Delegate {
operator fun getValue(t: Any?, p: KProperty<*>): Int = 1
}
fun box(): String {
val prop: Int by Delegate()
return run { if (prop == 1) "OK" else "fail" }
}