JVM: missed line number for return expression.
This commit is contained in:
committed by
max-kammerer
parent
c29f76580c
commit
5dc1651a44
@@ -1656,7 +1656,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
|||||||
|
|
||||||
Label afterReturnLabel = new Label();
|
Label afterReturnLabel = new Label();
|
||||||
generateFinallyBlocksIfNeeded(returnType, returnKotlinType, afterReturnLabel);
|
generateFinallyBlocksIfNeeded(returnType, returnKotlinType, afterReturnLabel);
|
||||||
|
markLineNumber(expression, false);
|
||||||
if (isNonLocalReturn) {
|
if (isNonLocalReturn) {
|
||||||
generateGlobalReturnFlag(v, nonLocalReturn.labelName);
|
generateGlobalReturnFlag(v, nonLocalReturn.labelName);
|
||||||
v.visitInsn(returnType.getOpcode(Opcodes.IRETURN));
|
v.visitInsn(returnType.getOpcode(Opcodes.IRETURN));
|
||||||
|
|||||||
+1
-3
@@ -13,9 +13,6 @@ inline fun getB(): Int {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
// old backend is missing a line number after return from inline function call, actually IR backend results seems more right.
|
|
||||||
|
|
||||||
// LINENUMBERS
|
// LINENUMBERS
|
||||||
// TestKt.box():4
|
// TestKt.box():4
|
||||||
// TestKt.box():13
|
// TestKt.box():13
|
||||||
@@ -24,3 +21,4 @@ inline fun getB(): Int {
|
|||||||
// TestKt.box():5
|
// TestKt.box():5
|
||||||
// TestKt.box():7
|
// TestKt.box():7
|
||||||
// TestKt.box():13
|
// TestKt.box():13
|
||||||
|
// TestKt.box():7
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
// This is same as kotlin/compiler/testData/codegen/boxInline/smap/smap.kt
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
|
import builders.*
|
||||||
|
|
||||||
|
inline fun test(): String {
|
||||||
|
var res = "Fail"
|
||||||
|
|
||||||
|
html {
|
||||||
|
head {
|
||||||
|
res = "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
var expected = test();
|
||||||
|
|
||||||
|
return expected
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: 1.kt
|
||||||
|
|
||||||
|
package builders
|
||||||
|
|
||||||
|
inline fun init(init: () -> Unit) {
|
||||||
|
init()
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun initTag2(init: () -> Unit) {
|
||||||
|
val p = 1;
|
||||||
|
init()
|
||||||
|
}
|
||||||
|
//{val p = initTag2(init); return p} to remove difference in linenumber processing through MethodNode and MethodVisitor should be: = initTag2(init)
|
||||||
|
inline fun head(init: () -> Unit) { val p = initTag2(init); return p}
|
||||||
|
|
||||||
|
|
||||||
|
inline fun html(init: () -> Unit) {
|
||||||
|
return init(init)
|
||||||
|
}
|
||||||
|
|
||||||
|
// LINENUMBERS
|
||||||
|
// TestKt.box():19
|
||||||
|
// TestKt.box():7
|
||||||
|
// TestKt.box():9
|
||||||
|
// TestKt.box():18
|
||||||
|
// TestKt.box():6
|
||||||
|
// TestKt.box():10
|
||||||
|
// TestKt.box():14
|
||||||
|
// TestKt.box():10
|
||||||
|
// TestKt.box():11
|
||||||
|
// TestKt.box():11
|
||||||
|
// TestKt.box():12
|
||||||
|
// TestKt.box():12
|
||||||
|
// TestKt.box():14
|
||||||
|
// TestKt.box():13
|
||||||
|
// TestKt.box():7
|
||||||
|
// TestKt.box():18
|
||||||
|
// TestKt.box():15
|
||||||
|
// TestKt.box():19
|
||||||
|
// TestKt.box():21
|
||||||
+6
@@ -85,6 +85,12 @@ public class IrSteppingTestGenerated extends AbstractIrSteppingTest {
|
|||||||
runTest("compiler/testData/debug/stepping/namedCallableReference.kt");
|
runTest("compiler/testData/debug/stepping/namedCallableReference.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("nestedInline.kt")
|
||||||
|
public void testNestedInline() throws Exception {
|
||||||
|
runTest("compiler/testData/debug/stepping/nestedInline.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("recursion.kt")
|
@TestMetadata("recursion.kt")
|
||||||
public void testRecursion() throws Exception {
|
public void testRecursion() throws Exception {
|
||||||
|
|||||||
+6
@@ -85,6 +85,12 @@ public class SteppingTestGenerated extends AbstractSteppingTest {
|
|||||||
runTest("compiler/testData/debug/stepping/namedCallableReference.kt");
|
runTest("compiler/testData/debug/stepping/namedCallableReference.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("nestedInline.kt")
|
||||||
|
public void testNestedInline() throws Exception {
|
||||||
|
runTest("compiler/testData/debug/stepping/nestedInline.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("recursion.kt")
|
@TestMetadata("recursion.kt")
|
||||||
public void testRecursion() throws Exception {
|
public void testRecursion() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user