[Codegen][JVM]: Mark line number before invoking intrinsics

Fixes #KT-61768
This commit is contained in:
Xin Wang
2023-11-13 17:29:25 +08:00
committed by Space Team
parent 0898dd1e7f
commit 11749d7c89
5 changed files with 30 additions and 1 deletions
@@ -4606,6 +4606,12 @@ public class FirLightTreeBytecodeTextTestGenerated extends AbstractFirLightTreeB
runTest("compiler/testData/codegen/bytecodeText/lineNumbers/inlineLambdaObjectInit.kt");
}
@Test
@TestMetadata("kt61768.kt")
public void testKt61768() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/lineNumbers/kt61768.kt");
}
@Test
@TestMetadata("singleThen.kt")
public void testSingleThen() throws Exception {
@@ -4606,6 +4606,12 @@ public class FirPsiBytecodeTextTestGenerated extends AbstractFirPsiBytecodeTextT
runTest("compiler/testData/codegen/bytecodeText/lineNumbers/inlineLambdaObjectInit.kt");
}
@Test
@TestMetadata("kt61768.kt")
public void testKt61768() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/lineNumbers/kt61768.kt");
}
@Test
@TestMetadata("singleThen.kt")
public void testSingleThen() throws Exception {
@@ -582,7 +582,10 @@ class ExpressionCodegen(
override fun visitCall(expression: IrCall, data: BlockInfo): PromisedValue {
val intrinsic = classCodegen.context.getIntrinsic(expression.symbol) as IntrinsicMethod?
intrinsic?.invoke(expression, this, data)?.let { return it }
if (intrinsic != null) {
expression.markLineNumber(true)
intrinsic.invoke(expression, this, data)?.let { return it }
}
val callee = expression.symbol.owner
require(callee.parent is IrClass) { "Unhandled intrinsic in ExpressionCodegen: ${callee.render()}" }
@@ -0,0 +1,8 @@
// TARGET_BACKEND: JVM_IR
fun increment() {
var i = 10
i = i + 10
}
// 1 LINENUMBER 5 L1\n +IINC
@@ -4606,6 +4606,12 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
runTest("compiler/testData/codegen/bytecodeText/lineNumbers/inlineLambdaObjectInit.kt");
}
@Test
@TestMetadata("kt61768.kt")
public void testKt61768() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/lineNumbers/kt61768.kt");
}
@Test
@TestMetadata("singleThen.kt")
public void testSingleThen() throws Exception {