Debugger, BE: Provide Java-like stepping for 'for' loops
- Visit '}' instead of 'for' keyword on post-condition - Visit 'for' keyword on pre-condition
This commit is contained in:
Generated
-8
@@ -1,8 +0,0 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact build-on-make="true" name="dist_root">
|
||||
<output-path>$PROJECT_DIR$/dist</output-path>
|
||||
<root id="root">
|
||||
<element id="artifact" artifact-name="dist" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
@@ -677,6 +677,10 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
generator.checkEmptyLoop(loopExit);
|
||||
|
||||
v.mark(loopEntry);
|
||||
resetLastLineNumber();
|
||||
markStartLineNumber(generator.getForExpression());
|
||||
v.nop();
|
||||
|
||||
generator.checkPreCondition(loopExit);
|
||||
|
||||
// Some forms of for-loop can be optimized as post-condition loops.
|
||||
@@ -1507,10 +1511,14 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
}
|
||||
} else {
|
||||
//if it used as argument of infix call (in this case lineNumber for simple inlineCall also would be reset)
|
||||
myLastLineNumber = -1;
|
||||
resetLastLineNumber();
|
||||
}
|
||||
}
|
||||
|
||||
private void resetLastLineNumber() {
|
||||
myLastLineNumber = -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLastLineNumber() {
|
||||
return myLastLineNumber;
|
||||
|
||||
@@ -16,5 +16,4 @@ fun box() {
|
||||
// TestKt:7: map:java.util.Collections$SingletonMap
|
||||
// TestKt:9: map:java.util.Collections$SingletonMap, a:java.lang.String, b:java.lang.String
|
||||
// TestKt:7: map:java.util.Collections$SingletonMap
|
||||
// TestKt:8: map:java.util.Collections$SingletonMap
|
||||
// TestKt:11: map:java.util.Collections$SingletonMap
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
//FILE: test.kt
|
||||
fun box() {
|
||||
for (i in 1..3) {
|
||||
foo(i)
|
||||
}
|
||||
}
|
||||
|
||||
inline fun foo(n: Int) {}
|
||||
|
||||
// LINENUMBERS
|
||||
// TestKt.box():3
|
||||
// TestKt.box():4
|
||||
// TestKt.box():8
|
||||
// TestKt.box():3
|
||||
// TestKt.box():4
|
||||
// TestKt.box():8
|
||||
// TestKt.box():3
|
||||
// TestKt.box():4
|
||||
// TestKt.box():8
|
||||
// TestKt.box():3
|
||||
// TestKt.box():6
|
||||
+6
@@ -43,6 +43,12 @@ public class IrSteppingTestGenerated extends AbstractIrSteppingTest {
|
||||
runTest("compiler/testData/debug/stepping/conjunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("for.kt")
|
||||
public void testFor() throws Exception {
|
||||
runTest("compiler/testData/debug/stepping/for.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionInAnotherFile.kt")
|
||||
public void testFunctionInAnotherFile() throws Exception {
|
||||
|
||||
+6
@@ -43,6 +43,12 @@ public class SteppingTestGenerated extends AbstractSteppingTest {
|
||||
runTest("compiler/testData/debug/stepping/conjunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("for.kt")
|
||||
public void testFor() throws Exception {
|
||||
runTest("compiler/testData/debug/stepping/for.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionInAnotherFile.kt")
|
||||
public void testFunctionInAnotherFile() throws Exception {
|
||||
|
||||
-1
@@ -5,7 +5,6 @@ continueLabel.kt:5
|
||||
continueLabel.kt:6
|
||||
continueLabel.kt:7
|
||||
continueLabel.kt:8
|
||||
continueLabel.kt:10
|
||||
continueLabel.kt:5
|
||||
continueLabel.kt:6
|
||||
continueLabel.kt:7
|
||||
|
||||
@@ -15,4 +15,4 @@ fun main(args: Array<String>) {
|
||||
val z = 1
|
||||
}
|
||||
|
||||
// STEP_INTO: 14
|
||||
// STEP_INTO: 17
|
||||
@@ -16,6 +16,7 @@ forLoop.kt:12
|
||||
forLoop.kt:13
|
||||
forLoop.kt:11
|
||||
forLoop.kt:15
|
||||
forLoop.kt:16
|
||||
Disconnected from the target VM
|
||||
|
||||
Process finished with exit code 0
|
||||
|
||||
+1
-1
@@ -12,4 +12,4 @@ fun main(args: Array<String>) {
|
||||
|
||||
// STEP_OVER: 4
|
||||
|
||||
// Tests that last line will be "9", no "11". See KT-13534.
|
||||
// See KT-13534.
|
||||
|
||||
Vendored
+1
@@ -6,6 +6,7 @@ inlineCallInForRangeExpression.kt:8
|
||||
inlineCallInForRangeExpression.kt:9
|
||||
inlineCallInForRangeExpression.kt:8
|
||||
inlineCallInForRangeExpression.kt:9
|
||||
inlineCallInForRangeExpression.kt:8
|
||||
inlineCallInForRangeExpression.kt:11
|
||||
Disconnected from the target VM
|
||||
|
||||
|
||||
Reference in New Issue
Block a user