[JS IR & WASM] Fix executing init blocks for enums with nested objects
This commit is contained in:
+27
-6
@@ -1,7 +1,7 @@
|
||||
// IGNORE_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: IGNORED_IN_JS
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
// DONT_TARGET_EXACT_BACKEND: JS
|
||||
// DONT_TARGET_EXACT_BACKEND: JS_IR
|
||||
// DONT_TARGET_EXACT_BACKEND: JS_IR_ES6
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
var result = ""
|
||||
|
||||
@@ -41,11 +41,32 @@ enum class F(a: String) {
|
||||
}
|
||||
}
|
||||
|
||||
enum class G(a: String) {
|
||||
X("x"),
|
||||
Y("y");
|
||||
|
||||
init {
|
||||
result += "G.init($a);"
|
||||
}
|
||||
|
||||
object O {
|
||||
init {
|
||||
result += "G.O.init;"
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
result += "G.O.foo();$X;"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val y = E.Y
|
||||
result += "${y.name};"
|
||||
F.foo()
|
||||
if (result != "E.init(x);E.init(y);E.companion.init;X;Y;F.init(x);F.init(y);F.companion.init;F.foo();X;") return "fail: $result"
|
||||
G.O.foo()
|
||||
if (result != "E.init(x);E.init(y);E.companion.init;X;Y;F.init(x);F.init(y);F.companion.init;F.foo();X;G.O.init;G.O.foo();X;")
|
||||
return "fail: $result"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user