Evaluator: Support 'field' variable evaluation for top-level properties
This commit is contained in:
+9
-3
@@ -211,9 +211,15 @@ class VariableFinder private constructor(private val context: ExecutionContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun findFieldVariable(kind: VariableKind.FieldVar): Result? {
|
private fun findFieldVariable(kind: VariableKind.FieldVar): Result? {
|
||||||
val thisObject = frameProxy.thisObject() ?: return null
|
val thisObject = frameProxy.thisObject()
|
||||||
val field = thisObject.referenceType().fieldByName(kind.fieldName) ?: return null
|
if (thisObject != null) {
|
||||||
return Result(thisObject.getValue(field))
|
val field = thisObject.referenceType().fieldByName(kind.fieldName) ?: return null
|
||||||
|
return Result(thisObject.getValue(field))
|
||||||
|
} else {
|
||||||
|
val containingType = frameProxy.safeLocation()?.declaringType() ?: return null
|
||||||
|
val field = containingType.fieldByName(kind.fieldName) ?: return null
|
||||||
|
return Result(containingType.getValue(field))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun findLocalFunction(kind: VariableKind.LocalFunction): Result? {
|
private fun findLocalFunction(kind: VariableKind.LocalFunction): Result? {
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package staticField
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
x
|
||||||
|
}
|
||||||
|
|
||||||
|
val x: String = "x"
|
||||||
|
//Breakpoint!
|
||||||
|
get() = "foo" + field
|
||||||
|
|
||||||
|
// EXPRESSION: field
|
||||||
|
// RESULT: "x": Ljava/lang/String;
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
LineBreakpoint created at staticField.kt:9
|
||||||
|
Run Java
|
||||||
|
Connected to the target VM
|
||||||
|
staticField.kt:9
|
||||||
|
Compile bytecode for field
|
||||||
|
Disconnected from the target VM
|
||||||
|
|
||||||
|
Process finished with exit code 0
|
||||||
Generated
+5
@@ -356,6 +356,11 @@ public class KotlinEvaluateExpressionTestGenerated extends AbstractKotlinEvaluat
|
|||||||
runTest("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/simple.kt");
|
runTest("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/simple.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("staticField.kt")
|
||||||
|
public void testStaticField() throws Exception {
|
||||||
|
runTest("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/staticField.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("stdlib.kt")
|
@TestMetadata("stdlib.kt")
|
||||||
public void testStdlib() throws Exception {
|
public void testStdlib() throws Exception {
|
||||||
runTest("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/stdlib.kt");
|
runTest("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/stdlib.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user