Evaluate expression: support EE on method with expression body, on properties

#KT-5485 Fixed
This commit is contained in:
Natalia Ukhorskaya
2014-08-06 17:08:01 +04:00
parent 3a7f66b7eb
commit de7b6cb3a1
11 changed files with 300 additions and 24 deletions
@@ -0,0 +1,14 @@
LineBreakpoint created at whenEntry.kt:10
LineBreakpoint created at whenEntry.kt:18
LineBreakpoint created at whenEntry.kt:26
!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!;!RT_JAR! whenEntry.WhenEntryPackage
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
whenEntry.kt:9
Compile bytecode for a
whenEntry.kt:17
Compile bytecode for a
whenEntry.kt:25
Compile bytecode for a
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
@@ -0,0 +1,21 @@
LineBreakpoint created at withoutBodyFunctions.kt:9
LineBreakpoint created at withoutBodyFunctions.kt:15
LineBreakpoint created at withoutBodyFunctions.kt:21
LineBreakpoint created at withoutBodyFunctions.kt:27
LineBreakpoint created at withoutBodyFunctions.kt:32
LineBreakpoint created at withoutBodyFunctions.kt:36
!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!;!RT_JAR! withoutBodyFunctions.WithoutBodyFunctionsPackage
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
withoutBodyFunctions.kt:8
Compile bytecode for 1 + 1
withoutBodyFunctions.kt:14
Compile bytecode for 1 + 2
withoutBodyFunctions.kt:20
Compile bytecode for i
withoutBodyFunctions.kt:26
Compile bytecode for i
withoutBodyFunctions.kt:31
Compile bytecode for i
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
@@ -0,0 +1,21 @@
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
!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!;!RT_JAR! withoutBodyProperties.WithoutBodyPropertiesPackage
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
withoutBodyProperties.kt:7
Compile bytecode for 1 + 1
withoutBodyProperties.kt:12
Compile bytecode for 1 + 2
withoutBodyProperties.kt:17
Compile bytecode for 1 + 3
withoutBodyProperties.kt:28
Compile bytecode for i
withoutBodyProperties.kt:28
withoutBodyProperties.kt:35
Compile bytecode for 1 + 4
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
@@ -0,0 +1,8 @@
LineBreakpoint created at withoutBodyTypeParameters.kt:8
!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!;!RT_JAR! withoutBodyTypeParameters.WithoutBodyTypeParametersPackage
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
withoutBodyTypeParameters.kt:7
Compile bytecode for i
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
@@ -0,0 +1,31 @@
package whenEntry
fun main(args: Array<String>) {
val a = 1
// EXPRESSION: a
// RESULT: 1: I
val b = when {
//Breakpoint!
a == 1 -> 1 + 1
else -> 1 + 2
}
// EXPRESSION: a
// RESULT: 1: I
val c = when {
//Breakpoint!
a == 1 -> { 1 + 1 }
else -> 1 + 2
}
// EXPRESSION: a
// RESULT: 1: I
val d = when {
//Breakpoint!
a == 1 -> {
1 + 1
}
else -> 1 + 2
}
}
@@ -0,0 +1,46 @@
package withoutBodyFunctions
import kotlin.properties.Delegates
// EXPRESSION: 1 + 1
// RESULT: 2: I
val aGet: Int
//Breakpoint!
get() = 1
// EXPRESSION: 1 + 2
// RESULT: 3: I
val aGet2: Int
//Breakpoint!
get() { return 1 }
fun fooWithBody(i: Int): Int {
// EXPRESSION: i
// RESULT: 2: I
//Breakpoint!
return i
}
// EXPRESSION: i
// RESULT: 2: I
//Breakpoint!
fun foo(i: Int) = i
// EXPRESSION: i
// RESULT: 2: I
//Breakpoint!
fun fooOneLine(i: Int): Int { return 1 }
// Cannot stop at this breakpoint - empty body
//Breakpoint!
fun fooEmpty(i: Int) {}
fun main(args: Array<String>) {
aGet
aGet2
fooWithBody(2)
foo(2)
fooOneLine(2)
fooEmpty(2)
}
@@ -0,0 +1,45 @@
package withoutBodyProperties
import kotlin.properties.Delegates
// EXPRESSION: 1 + 1
// RESULT: 2: I
//Breakpoint!
val a = 1
// EXPRESSION: 1 + 2
// RESULT: 3: I
//Breakpoint!
var aDelegate: Int by Delegates.notNull()
// EXPRESSION: 1 + 3
// RESULT: 4: I
//Breakpoint!
val aLambda = { 1 + 1 }
class A {
{
// EXPRESSION: i
// RESULT: 1: I
// EXPRESSION: i
// RESULT: 2: I
for (i in 1..2) {
//Breakpoint!
val a = 1
}
}
// EXPRESSION: 1 + 4
// RESULT: 5: I
//Breakpoint!
val prop = 1
}
fun main(args: Array<String>) {
a
aDelegate = 1
aLambda
A().prop
}
@@ -0,0 +1,14 @@
package withoutBodyTypeParameters
import kotlin.properties.Delegates
// EXPRESSION: i
// RESULT: instance of java.lang.Integer(id=ID): Ljava/lang/Integer;
//Breakpoint!
fun foo<T>(i: T) = i
fun run(i: () -> Int) = 1
fun main(args: Array<String>) {
foo(2)
}