[JS IR] Support per-file mode and ES modules
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// SKIP_DCE_DRIVEN
|
||||
|
||||
enum class Bar {
|
||||
ONE {
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
// 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")}"
|
||||
}
|
||||
+4
-1
@@ -3,7 +3,10 @@
|
||||
// PROPERTY_LAZY_INITIALIZATION
|
||||
|
||||
// FILE: A.kt
|
||||
var result: String? = null
|
||||
|
||||
val a = "a".let {
|
||||
result = "OK"
|
||||
it + "a"
|
||||
}
|
||||
|
||||
@@ -13,5 +16,5 @@ fun foo() =
|
||||
// FILE: main.kt
|
||||
fun box(): String {
|
||||
val foo = foo()
|
||||
return if (js("typeof a") == "string" && js("a") == "aa") "OK" else "fail"
|
||||
return result!!
|
||||
}
|
||||
+2
-1
@@ -5,6 +5,7 @@
|
||||
|
||||
// FILE: A.kt
|
||||
val a1 = "a".let {
|
||||
throw Error()
|
||||
it + "a"
|
||||
}
|
||||
|
||||
@@ -39,5 +40,5 @@ fun box(): String {
|
||||
C.values()
|
||||
C.valueOf("OK")
|
||||
val baz = b
|
||||
return if (js("typeof a1") == "undefined") "OK" else "fail"
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
// TODO: Investigate ES modules issue
|
||||
|
||||
// FILE: Outer.kt
|
||||
|
||||
package another
|
||||
|
||||
Reference in New Issue
Block a user