Hide synthetic variables for local functions and destructured lambda parameters (Kotlin variables)

This commit is contained in:
Yan Zhulanow
2019-01-14 22:07:45 +03:00
parent ed88020a84
commit d039e3b1c0
9 changed files with 76 additions and 2 deletions
@@ -0,0 +1,20 @@
package lambdaParameterMangling
private data class Foo(val a: String, val b: Int)
private fun foo(foo: Foo, block: (Foo) -> Unit) {
block(foo)
}
fun main() {
foo(Foo("a", 5)) { (a, b) ->
//Breakpoint!
val c = 5
}
}
// SHOW_KOTLIN_VARIABLES
// PRINT_FRAME
// EXPRESSION: a.length + b
// RESULT: 6: I
@@ -0,0 +1,14 @@
LineBreakpoint created at lambdaParameterMangling.kt:12
Run Java
Connected to the target VM
lambdaParameterMangling.kt:12
Compile bytecode for a.length + b
frame = invoke:12, LambdaParameterManglingKt$main$1 {lambdaParameterMangling}
local = a: java.lang.String = a (sp = lambdaParameterMangling.kt, 10)
field = value: char[] = {char[1]@uniqueID} (sp = String.!EXT!)
element = 0 = 'a' 97
field = hash: int = 0 (sp = String.!EXT!)
local = b: int = 5 (sp = lambdaParameterMangling.kt, 10)
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,14 @@
package localFunctionMangling
fun main() {
fun foo() {}
//Breakpoint!
val a = 5
}
// SHOW_KOTLIN_VARIABLES
// PRINT_FRAME
// EXPRESSION: 1
// RESULT: 1: I
@@ -0,0 +1,9 @@
LineBreakpoint created at localFunctionMangling.kt:7
Run Java
Connected to the target VM
localFunctionMangling.kt:7
Compile bytecode for 1
frame = main:7, LocalFunctionManglingKt {localFunctionMangling}
Disconnected from the target VM
Process finished with exit code 0