Make breakpoints work in local functions in secondary constructors
This commit is contained in:
committed by
Nikolay Krasko
parent
1889f4f7b1
commit
60e3c8eecd
@@ -216,7 +216,8 @@ class DebuggerClassNameProvider(val myDebugProcess: DebugProcess, val scopes: Li
|
|||||||
KtNamedFunction::class.java,
|
KtNamedFunction::class.java,
|
||||||
KtPropertyAccessor::class.java,
|
KtPropertyAccessor::class.java,
|
||||||
KtProperty::class.java,
|
KtProperty::class.java,
|
||||||
KtClassInitializer::class.java)
|
KtClassInitializer::class.java,
|
||||||
|
KtSecondaryConstructor::class.java)
|
||||||
|
|
||||||
private fun getElementToCalculateClassName(notPositionedElement: PsiElement?): KtElement? {
|
private fun getElementToCalculateClassName(notPositionedElement: PsiElement?): KtElement? {
|
||||||
if (notPositionedElement?.javaClass as Class<*> in TYPES_TO_CALCULATE_CLASSNAME) return notPositionedElement as KtElement
|
if (notPositionedElement?.javaClass as Class<*> in TYPES_TO_CALCULATE_CLASSNAME) return notPositionedElement as KtElement
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
LineBreakpoint created at stopInLocalFunInSecondaryConstructor.kt:7
|
||||||
|
!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! stopInLocalFunInSecondaryConstructor.StopInLocalFunInSecondaryConstructorKt
|
||||||
|
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||||
|
stopInLocalFunInSecondaryConstructor.kt:7
|
||||||
|
stopInLocalFunInSecondaryConstructor.kt:8
|
||||||
|
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||||
|
|
||||||
|
Process finished with exit code 0
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
LineBreakpoint created at stopInlineCallInLocalFunInSecondaryConstructor.kt:8
|
||||||
|
!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! stopInlineCallInLocalFunInSecondaryConstructor.StopInlineCallInLocalFunInSecondaryConstructorKt
|
||||||
|
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||||
|
stopInlineCallInLocalFunInSecondaryConstructor.kt:8
|
||||||
|
stopInlineCallInLocalFunInSecondaryConstructor.kt:9
|
||||||
|
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||||
|
|
||||||
|
Process finished with exit code 0
|
||||||
Vendored
+19
@@ -0,0 +1,19 @@
|
|||||||
|
package stopInLocalFunInSecondaryConstructor
|
||||||
|
|
||||||
|
class Foo(bar: Any) {
|
||||||
|
constructor() : this(12) {
|
||||||
|
fun some() {
|
||||||
|
//Breakpoint!
|
||||||
|
nop()
|
||||||
|
nop()
|
||||||
|
}
|
||||||
|
|
||||||
|
some()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun nop() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
Foo()
|
||||||
|
}
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
package stopInlineCallInLocalFunInSecondaryConstructor
|
||||||
|
|
||||||
|
class Foo(bar: Any) {
|
||||||
|
constructor() : this(12) {
|
||||||
|
fun test() {
|
||||||
|
inlineFun {
|
||||||
|
//Breakpoint!
|
||||||
|
nop()
|
||||||
|
nop()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun nop() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
Foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun inlineFun(f: () -> Any) {
|
||||||
|
f()
|
||||||
|
}
|
||||||
@@ -752,6 +752,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
|
|||||||
doStepOverTest(fileName);
|
doStepOverTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("stopInLocalFunInSecondaryConstructor.kt")
|
||||||
|
public void testStopInLocalFunInSecondaryConstructor() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInLocalFunInSecondaryConstructor.kt");
|
||||||
|
doStepOverTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("stopInLocalFunInlineCallLambda.kt")
|
@TestMetadata("stopInLocalFunInlineCallLambda.kt")
|
||||||
public void testStopInLocalFunInlineCallLambda() throws Exception {
|
public void testStopInLocalFunInlineCallLambda() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInLocalFunInlineCallLambda.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInLocalFunInlineCallLambda.kt");
|
||||||
@@ -781,6 +787,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
|
|||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInObjectLiteralInInlineCallWithClosure.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInObjectLiteralInInlineCallWithClosure.kt");
|
||||||
doStepOverTest(fileName);
|
doStepOverTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("stopInlineCallInLocalFunInSecondaryConstructor.kt")
|
||||||
|
public void testStopInlineCallInLocalFunInSecondaryConstructor() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInlineCallInLocalFunInSecondaryConstructor.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