Do not store nulls for captured variables going out of scope

These values can't be read after going out of scope.
JVM implementation can take care of such object references on its own.
Ref objects for captured variables are not different from any other
objects stored in local variables, so there's really no reason to
nullify these references explicitly.

 #KT-18478 Fixed Target versions 1.1.4
This commit is contained in:
Dmitry Petrov
2017-06-19 17:28:44 +03:00
parent 9356c1e0ef
commit 786ac46fa6
3 changed files with 20 additions and 4 deletions

View File

@@ -0,0 +1,14 @@
fun runNoInline(block: ()-> Unit): Unit {
block()
}
fun use(x: Int) {}
fun test(): Unit {
var x = 0
runNoInline {
use(x)
}
}
// 0 ACONST_NULL