697b2b02f1
[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
38 lines
599 B
Kotlin
Vendored
38 lines
599 B
Kotlin
Vendored
// TARGET_BACKEND: JS_IR
|
|
// DONT_TARGET_EXACT_BACKEND: WASM
|
|
// PROPERTY_LAZY_INITIALIZATION
|
|
|
|
// FILE: A.kt
|
|
val a1 = "a".let {
|
|
it + "a"
|
|
}
|
|
|
|
object A {
|
|
private val foo = "foo"
|
|
val foo2 = foo
|
|
val ok = "OK"
|
|
}
|
|
|
|
class B(private val foo: String) {
|
|
val ok = foo
|
|
|
|
constructor(arg: Int) : this(arg.toString())
|
|
}
|
|
|
|
enum class C {
|
|
OK
|
|
}
|
|
|
|
const val b = "b"
|
|
|
|
// FILE: main.kt
|
|
fun box(): String {
|
|
val foo = A.ok
|
|
val bar = B("foo").ok
|
|
val bay = B(1).ok
|
|
C.OK
|
|
C.values()
|
|
C.valueOf("OK")
|
|
val baz = b
|
|
return if (js("typeof a1") == "undefined") "OK" else "fail"
|
|
} |