[JS IR] Support per-file mode and ES modules

This commit is contained in:
Svyatoslav Kuzmich
2021-02-23 15:44:06 +03:00
parent f479ac5c3a
commit 3f8dce4b53
140 changed files with 5136 additions and 609 deletions
@@ -0,0 +1,35 @@
// DONT_TARGET_EXACT_BACKEND: JS
// ES_MODULES
// FILE: main.kt
interface I {
fun ok(): String
}
inline fun ok(): I {
return object : I {
override fun ok() = "OK"
}
}
@JsName("convolutedOk")
@JsExport
inline fun convolutedOk(): I {
val fail = object : I {
override fun ok() = "fail"
}.ok()
return ok()
}
@JsExport
fun testOk(ok: Any): String {
if (ok !is I) return "fail"
return ok.ok()
}
// FILE: entry.mjs
// ENTRY_ES_MODULE
import { convolutedOk, testOk } from "./JS_TESTS/index.js";
console.assert(testOk(convolutedOk()) == "OK");