[JS IR] Support per-file mode and ES modules
This commit is contained in:
+35
@@ -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");
|
||||
Reference in New Issue
Block a user