Evaluate Expression: support local functions

This commit is contained in:
Natalia Ukhorskaya
2015-04-30 10:07:17 +03:00
parent 8c99183970
commit d7a301d698
8 changed files with 171 additions and 22 deletions
@@ -0,0 +1,26 @@
LineBreakpoint created at localFun.kt:9
LineBreakpoint created at localFun.kt:15
LineBreakpoint created at localFun.kt:21
LineBreakpoint created at localFun.kt:34
LineBreakpoint created at localFun.kt:43
LineBreakpoint created at localFun.kt:54
LineBreakpoint created at localFun.kt:61
!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! localFun.LocalFunPackage
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
localFun.kt:9
Compile bytecode for myLocalFun1()
localFun.kt:15
Compile bytecode for myLocalFun2()
localFun.kt:21
Compile bytecode for myLocalFun1() + 1
localFun.kt:34
Compile bytecode for myLocalFun4()
localFun.kt:43
Compile bytecode for myLocalFun5(2)
localFun.kt:54
Compile bytecode for myLocalFun6()
localFun.kt:61
Compile bytecode for myLocalFun6() + 1
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 localFunCustomLib.kt:5
!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! localFunInLibrary.LocalFunInLibraryPackage
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
localFunCustomLib.kt:6
Compile bytecode for localFun()
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
@@ -0,0 +1,9 @@
package localFunInLibrary
fun main(args: Array<String>) {
customLib.localFunInLibraryCustomLib.localFunInLibraryCustomLibMainFun()
}
// ADDITIONAL_BREAKPOINT: localFunCustomLib.kt:localFunInLibraryCustomLibProperty
// EXPRESSION: localFun()
// RESULT: 1: I
@@ -0,0 +1,65 @@
package localFun
fun main(args: Array<String>) {
fun myLocalFun1() = 1
// EXPRESSION: myLocalFun1()
// RESULT: 1: I
//Breakpoint!
myLocalFun1()
fun myLocalFun2() = 2
// EXPRESSION: myLocalFun2()
// RESULT: 2: I
//Breakpoint!
myLocalFun2()
fun myLocalFun3() {
// EXPRESSION: myLocalFun1() + 1
// RESULT: Cannot find local variable: name = myLocalFun1
//Breakpoint!
myLocalFun1() + 1
}
myLocalFun3()
fun myLocalFun4(): Int {
return 1
}
// EXPRESSION: myLocalFun4()
// RESULT: 1: I
//Breakpoint!
myLocalFun4()
fun myLocalFun5(i: Int): Int {
return i
}
// EXPRESSION: myLocalFun5(2)
// RESULT: 2: I
//Breakpoint!
myLocalFun5(2)
var i = 1
fun myLocalFun6(): Int {
i++
return i
}
// EXPRESSION: myLocalFun6()
// RESULT: 2: I
//Breakpoint!
myLocalFun6()
i = 1
fun myLocalFun7() {
// EXPRESSION: myLocalFun6() + 1
// RESULT: 3: I
//Breakpoint!
myLocalFun6() + 1
}
myLocalFun7()
}