rra/ilgonmic/exported-bridges-2

[JS IR] Use js name for signature

[JS] bridgeSavingExport only for JS IR

[JS IR] Fix test

[JS IR] Stable and non stable signatures

[JS IR] Consider return type in js signature and erase for JS name signature

[JS IR] Copy signature from wasm to JS and export bridge, not original

Merge-request: KT-MR-5174
This commit is contained in:
Ilya Goncharov
2021-12-08 08:30:14 +00:00
committed by Space
parent 0c74376cc4
commit 00289d3514
11 changed files with 127 additions and 61 deletions
@@ -0,0 +1,29 @@
// TARGET_BACKEND: JS_IR
// RUN_PLAIN_BOX_FUNCTION
// INFER_MAIN_MODULE
// MODULE: bridge_saving_after_export
// FILE: lib.kt
@JsExport
open class A<T> {
open fun foo(value: T): T = value
}
@JsExport
class B: A<String>() {
override fun foo(value: String): String = value
}
// FILE: test.js
function box() {
var a = new this["bridge_saving_after_export"].A()
var aFoo = a.foo("ok")
if (aFoo != "ok") return "fail 1"
var b = new this["bridge_saving_after_export"].B()
var bFoo = b.foo("ok")
if (bFoo != "ok") return "fail 2"
return "OK"
}