Write lineNumber when inline function result is written to property

This commit is contained in:
Natalia Ukhorskaya
2015-11-24 10:23:25 +03:00
parent f40e3857fa
commit 4a2e4312ea
5 changed files with 82 additions and 2 deletions
@@ -3323,7 +3323,12 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
StackValue storeTo = sharedVarType == null ? StackValue.local(index, varType) : StackValue.shared(index, varType);
storeTo.store(initializer, v);
storeTo.putReceiver(v, false);
initializer.put(initializer.type, v);
markLineNumber(variableDeclaration, false);
storeTo.storeSelector(initializer.type, v);
}
@NotNull
+1 -1
View File
@@ -3,4 +3,4 @@ fun foo() {
42
}
// 2 3 4
// 2 3 2 4
@@ -0,0 +1,21 @@
LineBreakpoint created at functionCallStoredToVariable.kt:7
LineBreakpoint created at functionCallStoredToVariable.kt:14
LineBreakpoint created at functionCallStoredToVariable.kt:21
LineBreakpoint created at functionCallStoredToVariable.kt:28
!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! functionCallStoredToVariable.FunctionCallStoredToVariableKt
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
functionCallStoredToVariable.kt:7
functionCallStoredToVariable.kt:4
functionCallStoredToVariable.kt:14
functionCallStoredToVariable.kt:0
functionCallStoredToVariable.kt:43
functionCallStoredToVariable.kt:11
functionCallStoredToVariable.kt:21
functionCallStoredToVariable.kt:18
functionCallStoredToVariable.kt:28
functionCallStoredToVariable.kt:0
functionCallStoredToVariable.kt:47
functionCallStoredToVariable.kt:25
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
@@ -0,0 +1,48 @@
package functionCallStoredToVariable
fun main(args: Array<String>) {
val a = inlineFunInt {
// STEP_OVER: 1
//Breakpoint!
1
}
// RESUME: 1
val b = simpleFunInt {
// STEP_OVER: 3
//Breakpoint!
1
}
// RESUME: 1
val c = inlineFunVoid {
// STEP_OVER: 1
//Breakpoint!
val aa = 1
}
// RESUME: 1
val d = simpleFunVoid {
// STEP_OVER: 3
//Breakpoint!
val aa = 1
}
}
inline fun inlineFunInt(f: () -> Int): Int {
val a = 1
return f()
}
inline fun inlineFunVoid(f: () -> Unit): Unit {
val a = 1
return f()
}
fun simpleFunInt(f: () -> Int): Int {
return f()
}
fun simpleFunVoid(f: () -> Unit): Unit {
return f()
}
@@ -511,6 +511,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
doCustomTest(fileName);
}
@TestMetadata("functionCallStoredToVariable.kt")
public void testFunctionCallStoredToVariable() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/custom/functionCallStoredToVariable.kt");
doCustomTest(fileName);
}
@TestMetadata("fwAbstractProperty.kt")
public void testFwAbstractProperty() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/custom/fwAbstractProperty.kt");