JS_IR: DCE

Could be enabled by toggling `-Xir-dce`

Box test output in js/js.translator/testData/out-min
This commit is contained in:
Anton Bannykh
2019-11-19 15:36:27 +03:00
parent faf4c05fc8
commit 81699299f5
23 changed files with 553 additions and 173 deletions
+1 -1
View File
@@ -3,5 +3,5 @@ package kotlin
// see StdLibTestBase.removeAdHocAssertions
fun fail(message: String? = null): Nothing {
throw Exception(message)
throw Throwable(message)
}
@@ -1,5 +1,7 @@
// EXPECTED_REACHABLE_NODES: 1276
// IGNORE_BACKEND: JS_IR
@JsExport
class A(val x: Char)
fun typeOf(x: dynamic): String = js("typeof x")
@@ -4,6 +4,7 @@ interface I {
val a: Char
}
@JsExport
object X : I {
override var a = '#'
}
@@ -1,5 +1,7 @@
// EXPECTED_REACHABLE_NODES: 1289
// IGNORE_BACKEND: JS_IR
@JsExport
open class A {
val foo: Char
get() = 'X'
@@ -3,6 +3,7 @@ package foo
import kotlin.reflect.KProperty
@JsExport
class A {
@JsName("xx") val x: Int by B(23)
@@ -1,5 +1,6 @@
// EXPECTED_REACHABLE_NODES: 1290
@JsExport
object A {
@JsName("js_method") fun f() = "method"
+1
View File
@@ -1,5 +1,6 @@
// EXPECTED_REACHABLE_NODES: 1291
@JsExport
object A {
@JsName("js_f") fun f(x: Int) = "f($x)"
+1 -1
View File
@@ -13,7 +13,7 @@ fun box(): String {
assertEquals(a.foo, undefined)
assertNotEquals(a.toString, undefined)
val b: dynamic = object {val bar = ""}
val b: dynamic = object {@JsName("bar") val bar = ""}
assertEquals(b.foo, undefined)
assertNotEquals(b.bar, undefined)
@@ -7,6 +7,7 @@ fun deinitialize(foo: dynamic) {
}
class Foo {
@JsName("bar")
lateinit var bar: String
fun test(): String {