mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 08:31:26 +00:00
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:
15
compiler/testData/codegen/bytecodeText/capturedVarsOptimization/capturedInLocalObject.kt
vendored
Normal file
15
compiler/testData/codegen/bytecodeText/capturedVarsOptimization/capturedInLocalObject.kt
vendored
Normal 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
|
||||
Reference in New Issue
Block a user