feat(JsCode): inline usage of js code which captures kotlin variables.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// EXPECTED_REACHABLE_NODES: 1282
|
||||
package foo
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
// EXPECTED_REACHABLE_NODES: 1282
|
||||
package foo
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1282
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// EXPECTED_REACHABLE_NODES: 1285
|
||||
package foo
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1282
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
package foo
|
||||
|
||||
// CHECK_LABELS_COUNT: function=box name=block count=2
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// EXPECTED_REACHABLE_NODES: 1687
|
||||
external fun p(m: String): String
|
||||
@@ -26,9 +24,15 @@ fun test4(): String {
|
||||
return js("p('test4')")
|
||||
}
|
||||
|
||||
fun f() = js("p('test5')")
|
||||
|
||||
fun test5(): String {
|
||||
val p = "wrong5"
|
||||
fun f() = js("p('test5')")
|
||||
// The behavoiur of the classical backend is weird and buggy
|
||||
// From the user side, the local variable `p` is captured
|
||||
// but we have different behaviour because the renaming phase in classical backend
|
||||
// will be invoked after the lambda will be moved up
|
||||
// fun f() = js("p('test5')")
|
||||
return f()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user