Fix evaluation for captured inline classes (KT-28487)

This commit is contained in:
Yan Zhulanow
2018-11-28 16:10:21 +09:00
parent 27ea02929a
commit e12af0e2d1
4 changed files with 28 additions and 1 deletions
@@ -324,7 +324,8 @@ class KotlinEvaluator(val codeFragment: KtCodeFragment, val sourcePosition: Sour
ClassReader(mainClassBytecode).accept(object : ClassVisitor(ASM5) {
override fun visitMethod(access: Int, name: String, desc: String, signature: String?, exceptions: Array<out String>?): MethodVisitor? {
if (name == GENERATED_FUNCTION_NAME) {
// Maybe just take the single method from the class, as it is done in 'evaluateWithCompilation'
if (name == GENERATED_FUNCTION_NAME || name.startsWith(GENERATED_FUNCTION_NAME + "-")) {
val argumentTypes = Type.getArgumentTypes(desc)
val args = context.getArgumentsForEval4j(compiledData.parameters, argumentTypes)
@@ -0,0 +1,12 @@
package inlineMethodsInSignature
inline class InlineMe(val x: Int)
fun main() {
val i = InlineMe(1)
//Breakpoint!
println()
}
// EXPRESSION: i
// RESULT: 1: I
@@ -0,0 +1,9 @@
LineBreakpoint created at inlineMethodsInSignature.kt:8
Run Java
Connected to the target VM
inlineMethodsInSignature.kt:8
Compile bytecode for i
Disconnected from the target VM
Process finished with exit code 0
@@ -186,6 +186,11 @@ public class KotlinEvaluateExpressionTestGenerated extends AbstractKotlinEvaluat
runTest("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/inlineFunctionBreakpointVariants.kt");
}
@TestMetadata("inlineMethodsInSignature.kt")
public void testInlineMethodsInSignature() throws Exception {
runTest("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/inlineMethodsInSignature.kt");
}
@TestMetadata("innerClass.kt")
public void testInnerClass() throws Exception {
runTest("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/innerClass.kt");