KT-5248 Don't wrap variable if it is captured only in inlined closures

Remove non-escaping Ref's on bytecode postprocessing pass.
This commit is contained in:
Dmitry Petrov
2017-01-31 15:43:17 +03:00
parent 3fc106572e
commit 3c09a26e16
38 changed files with 1115 additions and 26 deletions

View File

@@ -0,0 +1,15 @@
// WITH_RUNTIME
fun test() {
var x = 0
run {
val obj = object {
fun foo() { ++x }
}
obj.foo()
}
}
// 1 NEW kotlin/jvm/internal/Ref\$IntRef
// 2 GETFIELD kotlin/jvm/internal/Ref\$IntRef\.element
// 2 PUTFIELD kotlin/jvm/internal/Ref\$IntRef\.element