[JS IR] Add properties lazy initialization with multiple modules
[JS IR] Move tests into compiler/testData [JS IR] Add cyclic dependencies with lazy property initialization [JS IR] Add test on not initialization in case of call non properties (classed, objects, enum classes, const vals) [JS IR] Add initialization through top level [JS IR] Ignore enum getInstance function in property lazy initialization [JS IR] Use let function with useful result instead of pure apply and also [JS IR] Remove duplicated tests in js.translator
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// TARGET_BACKEND: JS_IR
|
||||
// PROPERTY_LAZY_INITIALIZATION
|
||||
|
||||
// FILE: A.kt
|
||||
|
||||
val a = "A"
|
||||
|
||||
// FILE: B.kt
|
||||
val b = "B".let {
|
||||
it + "B"
|
||||
}
|
||||
|
||||
val c = b
|
||||
|
||||
// FILE: C.kt
|
||||
val d = "D".let {
|
||||
it + "D"
|
||||
}
|
||||
|
||||
val e = d
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun box(): String {
|
||||
// Get only e to initialize all properties in file
|
||||
e
|
||||
return if (
|
||||
js("a") === "A" &&
|
||||
js("typeof b") == "undefined" &&
|
||||
js("typeof c") == "undefined" &&
|
||||
js("d") === "DD" &&
|
||||
js("e") === "DD"
|
||||
)
|
||||
"OK"
|
||||
else "a = ${js("a")}; typeof b = ${js("typeof b")}; typeof c = ${js("typeof c")}; d = ${js("d")}; e = ${js("e")}"
|
||||
}
|
||||
Reference in New Issue
Block a user