[JS IR] Add to IR keep possibility similar to legacy-dce one
It helps to: - keep declarations even if they are not reachable and not exported - not minify names of not exported declarations Compiler argument: -Xir-keep=A,B Can be used for top-level declarations or for member ^KT-54118 fixed
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
// TARGET_BACKEND: JS_IR
|
||||
// ONLY_IR_DCE
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// INFER_MAIN_MODULE
|
||||
// KEEP: A.foo
|
||||
|
||||
// MODULE: keep_overridden_method
|
||||
// FILE: lib.kt
|
||||
|
||||
open class A {
|
||||
open fun foo(): String {
|
||||
return "foo"
|
||||
}
|
||||
|
||||
open fun bar(): String {
|
||||
return "bar"
|
||||
}
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
override fun foo(): String {
|
||||
return super.foo() + "!"
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
fun bar(): B {
|
||||
return B()
|
||||
}
|
||||
|
||||
// FILE: test.js
|
||||
function box() {
|
||||
var b = this["keep_overridden_method"].bar()
|
||||
|
||||
if (b.foo_26di_k$() != "foo!") return "fail 1"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user