JVM: restore call site line number after inlining lambda
E.g. in `x + f()` where `f` is an inline lambda, the instructions for `+` should have the line number of that expression (while previously they instead had the line number of the last line of the lambda). ^KT-51738 Fixed
This commit is contained in:
+3
-3
@@ -12,7 +12,7 @@ inline fun inlineFunInt(f: () -> Int): Int {
|
||||
|
||||
inline fun inlineFunVoid(f: () -> Unit): Unit {
|
||||
val a = 1
|
||||
return f()
|
||||
return f() // return replaced with nop to stop here *after* calling f
|
||||
}
|
||||
|
||||
fun simpleFunInt(f: () -> Int): Int {
|
||||
@@ -20,7 +20,7 @@ fun simpleFunInt(f: () -> Int): Int {
|
||||
}
|
||||
|
||||
fun simpleFunVoid(f: () -> Unit): Unit {
|
||||
return f()
|
||||
return f() // return replaced with nop to stop here *after* calling f
|
||||
}
|
||||
|
||||
// 0 NOP
|
||||
// 2 NOP
|
||||
|
||||
+7
-7
@@ -1,13 +1,13 @@
|
||||
|
||||
fun box() {
|
||||
lookAtMe {
|
||||
val c = "c"
|
||||
}
|
||||
lookAtMe { // 1
|
||||
val c = "c" // 4
|
||||
} // 5 (nop)
|
||||
}
|
||||
|
||||
inline fun lookAtMe(f: (String) -> Unit) {
|
||||
val a = "a"
|
||||
f(a) // Should be no unneeded nops on this line, that might be generated for zero-parameters lambda
|
||||
}
|
||||
val a = "a" // 2
|
||||
f(a) // 3 before call, 6 after call (nop)
|
||||
} // 7 (nop)
|
||||
|
||||
// 2 NOP
|
||||
// 3 NOP
|
||||
|
||||
Reference in New Issue
Block a user