[JS IR] Generate context dependent names for anonymous objects and classes.
This commit is contained in:
committed by
Space
parent
b1643075f2
commit
a34c97ebd5
@@ -0,0 +1,15 @@
|
||||
class MyClass {
|
||||
companion object {
|
||||
fun ok(): String {
|
||||
val okMaker = object {
|
||||
fun getOk(): String = "OK"
|
||||
}
|
||||
return okMaker.getOk()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CHECK_FUNCTION_EXISTS: MyClass$Companion$ok$okMaker$1 TARGET_BACKENDS=JS_IR
|
||||
fun box(): String {
|
||||
return MyClass.ok()
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fun foo(a: () -> Unit) = a()
|
||||
|
||||
// CHECK_CALLED_IN_SCOPE: scope=box function=box$lambda
|
||||
fun box(): String {
|
||||
var result = "FAILURE"
|
||||
foo { result = "OK" }
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// CHECK_FUNCTION_EXISTS: box$MyClass TARGET_BACKENDS=JS_IR
|
||||
// CHECK_FUNCTION_EXISTS: box$MyClass$ok$InternalClass TARGET_BACKENDS=JS_IR
|
||||
fun box(): String {
|
||||
class MyClass {
|
||||
fun ok(): String {
|
||||
class InternalClass {
|
||||
fun getOk(): String = "OK"
|
||||
}
|
||||
return InternalClass().getOk()
|
||||
}
|
||||
}
|
||||
return MyClass().ok()
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
interface A {
|
||||
fun run()
|
||||
}
|
||||
|
||||
// CHECK_FUNCTION_EXISTS: box$a$1 TARGET_BACKENDS=JS_IR
|
||||
// CHECK_FUNCTION_EXISTS: box$a$1$run$b$1 TARGET_BACKENDS=JS_IR
|
||||
fun box(): String {
|
||||
var result = "FAILURE"
|
||||
|
||||
val a: A = object : A {
|
||||
override fun run() {
|
||||
val b = object {
|
||||
fun foo() {
|
||||
result = "OK"
|
||||
}
|
||||
}
|
||||
b.foo()
|
||||
}
|
||||
}
|
||||
|
||||
a.run()
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user