Generate linenumber for goto instruction in while (KT-13059)
Otherwise linenumber for previous instruction will be used in debugger. That can lead to error stepping because it might be line that isn't reachable on current iteration. #KT-13059 Fixed
This commit is contained in:
@@ -528,6 +528,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
|
||||
generateLoopBody(expression.getBody());
|
||||
|
||||
markStartLineNumber(expression);
|
||||
v.goTo(condition);
|
||||
|
||||
v.mark(end);
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
fun foo() {
|
||||
while (true) {
|
||||
if (testSome()) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun testSome(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
// 2 3 4 2 7 10
|
||||
@@ -148,6 +148,12 @@ public class LineNumberTestGenerated extends AbstractLineNumberTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/lineNumber/custom"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("beforeGotoToWhileStart.kt")
|
||||
public void testBeforeGotoToWhileStart() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/lineNumber/custom/beforeGotoToWhileStart.kt");
|
||||
doTestCustom(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("callWithCallInArguments.kt")
|
||||
public void testCallWithCallInArguments() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/lineNumber/custom/callWithCallInArguments.kt");
|
||||
|
||||
Reference in New Issue
Block a user