Support anonymous object constructor transformation and inline

This commit is contained in:
Mikhael Bogdanov
2014-04-24 16:14:17 +04:00
parent 9181302ce4
commit c5e9ea0d29
14 changed files with 350 additions and 87 deletions
@@ -0,0 +1,24 @@
import test.*
fun box() : String {
val o = "O"
val result = doWork {
val k = "K"
val s = object : A<String>("11") {
override fun getO(): String {
return o;
}
override fun getK(): String {
return k;
}
}
s.getO() + s.getK() + s.param
}
if (result != "OK11") return "fail $result"
return "OK"
}
@@ -0,0 +1,12 @@
package test
abstract class A<R>(val param: R) {
abstract fun getO() : R
abstract fun getK() : R
}
inline fun <R> doWork(job: ()-> R) : R {
return job()
}