Fix evaluate expression on properties with getter
This commit is contained in:
+13
-1
@@ -185,7 +185,19 @@ private fun addDebugExpressionBeforeContextElement(codeFragment: JetCodeFragment
|
||||
|
||||
val elementBefore = when {
|
||||
contextElement is JetProperty && !contextElement.isLocal() -> {
|
||||
wrapInRunFun(contextElement.getDelegateExpressionOrInitializer()!!)
|
||||
val delegateExpressionOrInitializer = contextElement.getDelegateExpressionOrInitializer()
|
||||
if (delegateExpressionOrInitializer != null) {
|
||||
wrapInRunFun(delegateExpressionOrInitializer)
|
||||
}
|
||||
else {
|
||||
val getter = contextElement.getGetter()!!
|
||||
if (!getter.hasBlockBody()) {
|
||||
wrapInRunFun(getter.getBodyExpression()!!)
|
||||
}
|
||||
else {
|
||||
(getter.getBodyExpression() as JetBlockExpression).getStatements().first()
|
||||
}
|
||||
}
|
||||
}
|
||||
contextElement is JetClassOrObject -> {
|
||||
insertNewInitializer(contextElement.getBody())
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
LineBreakpoint created at withoutBodyProperties.kt:8
|
||||
LineBreakpoint created at withoutBodyProperties.kt:13
|
||||
LineBreakpoint created at withoutBodyProperties.kt:18
|
||||
LineBreakpoint created at withoutBodyProperties.kt:29
|
||||
LineBreakpoint created at withoutBodyProperties.kt:36
|
||||
LineBreakpoint created at withoutBodyProperties.kt:23
|
||||
LineBreakpoint created at withoutBodyProperties.kt:28
|
||||
LineBreakpoint created at withoutBodyProperties.kt:39
|
||||
LineBreakpoint created at withoutBodyProperties.kt:46
|
||||
!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !APP_PATH!\classes;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! withoutBodyProperties.WithoutBodyPropertiesPackage
|
||||
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||
withoutBodyProperties.kt:8
|
||||
@@ -11,11 +13,15 @@ withoutBodyProperties.kt:13
|
||||
Compile bytecode for 1 + 2
|
||||
withoutBodyProperties.kt:18
|
||||
Compile bytecode for 1 + 3
|
||||
withoutBodyProperties.kt:29
|
||||
Compile bytecode for i
|
||||
withoutBodyProperties.kt:29
|
||||
withoutBodyProperties.kt:36
|
||||
withoutBodyProperties.kt:23
|
||||
Compile bytecode for 1 + 4
|
||||
withoutBodyProperties.kt:28
|
||||
Compile bytecode for 1 + 5
|
||||
withoutBodyProperties.kt:39
|
||||
Compile bytecode for i
|
||||
withoutBodyProperties.kt:39
|
||||
withoutBodyProperties.kt:46
|
||||
Compile bytecode for 1 + 6
|
||||
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||
|
||||
Process finished with exit code 0
|
||||
|
||||
+14
-2
@@ -17,6 +17,16 @@ var aDelegate: Int by Delegates.notNull()
|
||||
//Breakpoint!
|
||||
val aLambda = { 1 + 1 }
|
||||
|
||||
// EXPRESSION: 1 + 4
|
||||
// RESULT: 5: I
|
||||
//Breakpoint!
|
||||
val aWoBody: Int get() = 1
|
||||
|
||||
// EXPRESSION: 1 + 5
|
||||
// RESULT: 6: I
|
||||
//Breakpoint!
|
||||
val aWoBody2: Int get() { return 1 }
|
||||
|
||||
class A {
|
||||
init {
|
||||
// EXPRESSION: i
|
||||
@@ -30,8 +40,8 @@ class A {
|
||||
}
|
||||
}
|
||||
|
||||
// EXPRESSION: 1 + 4
|
||||
// RESULT: 5: I
|
||||
// EXPRESSION: 1 + 6
|
||||
// RESULT: 7: I
|
||||
//Breakpoint!
|
||||
val prop = 1
|
||||
}
|
||||
@@ -40,6 +50,8 @@ fun main(args: Array<String>) {
|
||||
a
|
||||
aDelegate = 1
|
||||
aLambda
|
||||
aWoBody
|
||||
aWoBody2
|
||||
|
||||
A().prop
|
||||
}
|
||||
Reference in New Issue
Block a user