Fix stepping for inline function inside while statement
This commit is contained in:
@@ -169,6 +169,12 @@ public class KotlinSteppingCommandProvider: JvmSteppingCommandProvider() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val whileParent = getParentOfType<KtWhileExpression>(false)
|
||||||
|
if (whileParent != null) {
|
||||||
|
// last statement in while
|
||||||
|
return (whileParent.body as? KtBlockExpression)?.statements?.lastOrNull()?.getLineNumber() == elementAt.getLineNumber()
|
||||||
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
LineBreakpoint created at stepOverWhileWithInline.kt:5
|
||||||
|
!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !OUTPUT_PATH!;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! stepOverWhileWithInline.StepOverWhileWithInlineKt
|
||||||
|
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||||
|
stepOverWhileWithInline.kt:5
|
||||||
|
stepOverWhileWithInline.kt:7
|
||||||
|
stepOverWhileWithInline.kt:8
|
||||||
|
stepOverWhileWithInline.kt:9
|
||||||
|
stepOverWhileWithInline.kt:30
|
||||||
|
stepOverWhileWithInline.kt:9
|
||||||
|
stepOverWhileWithInline.kt:7
|
||||||
|
stepOverWhileWithInline.kt:13
|
||||||
|
stepOverWhileWithInline.kt:14
|
||||||
|
stepOverWhileWithInline.kt:15
|
||||||
|
stepOverWhileWithInline.kt:13
|
||||||
|
stepOverWhileWithInline.kt:19
|
||||||
|
stepOverWhileWithInline.kt:20
|
||||||
|
stepOverWhileWithInline.kt:21
|
||||||
|
stepOverWhileWithInline.kt:24
|
||||||
|
stepOverWhileWithInline.kt:25
|
||||||
|
stepOverWhileWithInline.kt:26
|
||||||
|
stepOverWhileWithInline.kt:27
|
||||||
|
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||||
|
|
||||||
|
Process finished with exit code 0
|
||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
package stepOverWhileWithInline
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
//Breakpoint!
|
||||||
|
var prop = 0
|
||||||
|
// inline on last line of while
|
||||||
|
while(prop < 1) {
|
||||||
|
prop++
|
||||||
|
foo { test(1) }
|
||||||
|
}
|
||||||
|
|
||||||
|
// inline call inside while
|
||||||
|
while(prop < 2) {
|
||||||
|
foo { test(1) }
|
||||||
|
prop++
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
prop++
|
||||||
|
foo { test(1) }
|
||||||
|
} while(prop < 3)
|
||||||
|
|
||||||
|
do {
|
||||||
|
foo { test(1) }
|
||||||
|
prop++
|
||||||
|
} while(prop < 4)
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun foo(f: () -> Int): Int {
|
||||||
|
val a = 1
|
||||||
|
return f()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test(i: Int) = i
|
||||||
|
|
||||||
|
// STEP_OVER: 41
|
||||||
@@ -396,6 +396,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
|
|||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverWhenWithInline.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverWhenWithInline.kt");
|
||||||
doStepOverTest(fileName);
|
doStepOverTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("stepOverWhileWithInline.kt")
|
||||||
|
public void testStepOverWhileWithInline() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverWhileWithInline.kt");
|
||||||
|
doStepOverTest(fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("idea/testData/debugger/tinyApp/src/stepping/filters")
|
@TestMetadata("idea/testData/debugger/tinyApp/src/stepping/filters")
|
||||||
|
|||||||
Reference in New Issue
Block a user