Fix for KT-10659: Debugger: Evaluate Expression and Watches fail for inline function parameter passed by reference

#KT-10659 Fixed
This commit is contained in:
Michael Bogdanov
2016-01-25 17:06:31 +03:00
parent 069282cb6e
commit d4df7aaabc
5 changed files with 41 additions and 2 deletions
@@ -94,8 +94,8 @@ public class LocalVarRemapper {
public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index, MethodVisitor mv) {
RemapInfo info = doRemap(index);
//add entries only for shifted vars
if (SHIFT == info.status) {
//add entries only for shifted vars or remapped to locals
if (SHIFT == info.status || REMAPPED == info.status && info.value instanceof StackValue.Local) {
int newIndex = ((StackValue.Local) info.value).index;
mv.visitLocalVariable(name, desc, signature, start, end, newIndex);
}
@@ -0,0 +1,11 @@
inline fun watch(p: String, f: (String) -> Int) {
f(p)
}
fun main(args: Array<String>) {
val local = "mno"
watch(local) { it.length }
}
// 2 LOCALVARIABLE p
// 1 LOCALVARIABLE p\$iv
@@ -760,6 +760,12 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
doTest(fileName);
}
@TestMetadata("remappedLocalVar.kt")
public void testRemappedLocalVar() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/inline/remappedLocalVar.kt");
doTest(fileName);
}
@TestMetadata("removedFinallyMarkers.kt")
public void testRemovedFinallyMarkers() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/inline/removedFinallyMarkers.kt");