Restore original variable name mangling for captured/receiver $this
Design for the new one is still not finished.
This commit is contained in:
@@ -37,22 +37,14 @@ fun mangleNameIfNeeded(name: String): String {
|
||||
if (c.isValidCharacter()) {
|
||||
append(c)
|
||||
} else {
|
||||
append('-').append(c.toHex())
|
||||
val hexString = Integer.toHexString(c.toInt())
|
||||
assert(hexString.length <= 4)
|
||||
append("_u").append(hexString)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun Char.toHex(): String {
|
||||
val hexString = Integer.toHexString(this.toInt())
|
||||
assert(hexString.length <= 4)
|
||||
return if (hexString.length == 4) {
|
||||
hexString
|
||||
} else {
|
||||
"0".repeat(4 - hexString.length) + hexString
|
||||
}
|
||||
}
|
||||
|
||||
private fun Char.isValidCharacter(): Boolean {
|
||||
return this != '$' && this != '-' && isValidDalvikCharacter(this)
|
||||
}
|
||||
+1
-1
@@ -13,6 +13,6 @@ suspend fun test() = foo(A()) { (x_param, _, y_param) -> x_param + y_param }
|
||||
// METHOD : UnderscoreNamesKt$test$2.invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object;
|
||||
// VARIABLE : NAME=this TYPE=LUnderscoreNamesKt$test$2; INDEX=0
|
||||
// VARIABLE : NAME=result TYPE=Ljava/lang/Object; INDEX=1
|
||||
// VARIABLE : NAME=$dstr$x_param$-0024_-0024$y_param TYPE=LA; INDEX=2
|
||||
// VARIABLE : NAME=$dstr$x_param$_u24__u24$y_param TYPE=LA; INDEX=2
|
||||
// VARIABLE : NAME=x_param TYPE=Ljava/lang/String; INDEX=3
|
||||
// VARIABLE : NAME=y_param TYPE=Ljava/lang/String; INDEX=4
|
||||
|
||||
@@ -28,7 +28,7 @@ fun box() {
|
||||
// VARIABLE : NAME=c TYPE=C INDEX=9
|
||||
// VARIABLE : NAME=a TYPE=D INDEX=7
|
||||
// VARIABLE : NAME=this TYPE=LUnderscoreNamesKt$box$1; INDEX=0
|
||||
// VARIABLE : NAME=$dstr$x$-0024_-0024$y TYPE=LA; INDEX=1
|
||||
// VARIABLE : NAME=$dstr$x$_u24__u24$y TYPE=LA; INDEX=1
|
||||
// VARIABLE : NAME=$noName_1 TYPE=Ljava/lang/String; INDEX=2
|
||||
// VARIABLE : NAME=w TYPE=I INDEX=3
|
||||
// VARIABLE : NAME=x TYPE=D INDEX=4
|
||||
|
||||
@@ -77,8 +77,8 @@ final class LocalFunctionsKt$foo$5 : kotlin/jvm/internal/Lambda, kotlin/jvm/func
|
||||
public final class LocalFunctionsKt : java/lang/Object {
|
||||
public final static void foo() {
|
||||
Local variables:
|
||||
4 $fun$c-0024d$5: LLocalFunctionsKt$foo$5;
|
||||
3 $fun$b-0020c$4: LLocalFunctionsKt$foo$4;
|
||||
4 $fun$c_u24d$5: LLocalFunctionsKt$foo$5;
|
||||
3 $fun$b_u20c$4: LLocalFunctionsKt$foo$4;
|
||||
2 $fun$a2$3: LLocalFunctionsKt$foo$3;
|
||||
1 $fun$a2$2: LLocalFunctionsKt$foo$2;
|
||||
0 $fun$a$1: LLocalFunctionsKt$foo$1;
|
||||
|
||||
@@ -101,10 +101,10 @@ final class MangledNamesKt$foo$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/functi
|
||||
|
||||
public java.lang.Object invoke(java.lang.Object p0)
|
||||
|
||||
public final void invoke(Arr $dstr$a-0020b$b-0024c$c-002dd$b-0024-0024c-002d-002dd$a-0028-0029§-0026-002a-0026-005e-0040あ化) {
|
||||
public final void invoke(Arr $dstr$a_u20b$b_u24c$c_u2dd$b_u24_u24c_u2d_u2dd$a_u28_u29§_u26_u2a_u26_u5e_u40あ化) {
|
||||
Local variables:
|
||||
0 this: LMangledNamesKt$foo$1;
|
||||
1 $dstr$a-0020b$b-0024c$c-002dd$b-0024-0024c-002d-002dd$a-0028-0029§-0026-002a-0026-005e-0040あ化: LArr;
|
||||
1 $dstr$a_u20b$b_u24c$c_u2dd$b_u24_u24c_u2d_u2dd$a_u28_u29§_u26_u2a_u26_u5e_u40あ化: LArr;
|
||||
2 a b: I
|
||||
3 b$c: I
|
||||
4 c-d: I
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ Compile bytecode for arrayOfA
|
||||
frame = invoke:18, UnderscoreNamesKt$main$1 {underscoreNames}
|
||||
this = this = {underscoreNames.UnderscoreNamesKt$main$1@uniqueID}Function3<underscoreNames.A, java.lang.String, java.lang.Integer, java.lang.String>
|
||||
field = arity: int = 3 (sp = Lambda.!EXT!)
|
||||
local = $dstr$x$-0024_-0024$y: underscoreNames.A = {underscoreNames.A@uniqueID}A(x=1.0, y=, z=0) (sp = null)
|
||||
local = $dstr$x$_u24__u24$y: underscoreNames.A = {underscoreNames.A@uniqueID}A(x=1.0, y=, z=0) (sp = null)
|
||||
field = x: double = 1.0 (sp = underscoreNames.kt, 2)
|
||||
field = y: java.lang.String = (sp = underscoreNames.kt, 2)
|
||||
field = value: char[] = {char[0]@uniqueID} (sp = String.!EXT!)
|
||||
|
||||
Reference in New Issue
Block a user