Use CodegenContext to determine outer class & enclosing method

This commit is contained in:
Alexander Udalov
2015-02-11 00:38:44 +03:00
parent c417d984c4
commit 9b28e19551
8 changed files with 239 additions and 156 deletions
@@ -0,0 +1,20 @@
trait A {
fun f(): String
}
inline fun foo(): A {
return object : A {
override fun f(): String {
return "OK"
}
}
}
fun box(): String {
val y = foo()
val enclosing = y.javaClass.getEnclosingMethod()
if (enclosing?.getName() != "foo") return "method: $enclosing"
return y.f()
}