[K/JS] Add file-to-file compilation ^KT-6168 Fixed

This commit is contained in:
Artem Kobzar
2023-06-22 18:23:45 +00:00
committed by Space Team
parent a44b5e4562
commit 64158a8a2f
74 changed files with 947 additions and 608 deletions
@@ -0,0 +1,39 @@
// DONT_TARGET_EXACT_BACKEND: JS
// SKIP_MINIFICATION
// ES_MODULES
// SPLIT_PER_FILE
// FILE: base.kt
@JsExport
open class Base() {
var bar = "bar"
fun foo() = "foo"
}
// FILE: a.kt
@JsExport
class A : Base() {
val pong = "pong"
fun ping() = "ping"
}
// FILE: function.kt
@JsExport
fun create() = A()
// FILE: main.kt
@JsModule("./perFileExportedApi.mjs")
external fun jsBox(): String
fun box(): String {
val res = jsBox()
if (res != "bar&not bar&foo&ping&pong") {
return "Fail: ${res}"
}
return "OK"
}
@@ -0,0 +1,15 @@
import { create } from "./perFileExportedApi-kotlin_main_v5/function.export.mjs";
export default function() {
let result = ""
const a = create()
result += a.bar
a.bar = "not bar"
result += `&${a.bar}`
result += `&${a.foo()}`
result += `&${a.ping()}`
result += `&${a.pong}`
return result
};