Restore original variable name mangling for captured/receiver $this

Design for the new one is still not finished.
This commit is contained in:
Yan Zhulanow
2019-02-20 05:30:28 +03:00
parent 1edacbbb5e
commit 28e4356e6e
6 changed files with 10 additions and 18 deletions
@@ -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)
}