JS backend: added delegate property support.

This commit is contained in:
Erokhin Stanislav
2013-08-14 19:40:43 +04:00
parent 8ee5911a87
commit 8c952ebfdb
18 changed files with 407 additions and 11 deletions
@@ -0,0 +1,19 @@
package foo
class Delegate {
var inner = 1
fun get(t: Any?, p: PropertyMetadata): Int = inner
}
fun Delegate.set(t: Any?, p: PropertyMetadata, i: Int) { inner = i }
class A {
var prop: Int by Delegate()
}
fun box(): String {
val c = A()
if(c.prop != 1) return "fail get"
c.prop = 2
if (c.prop != 2) return "fail set"
return "OK"
}