Files
kotlin-fork/js/js.translator/testData/box/jsCode/continue.kt
T
Svyatoslav Kuzmich cb3b1f8ae2 [JS IR] Fix referencing Kotin variables in inline JS code
Fixed by outlining JS code that uses Kotlin variables making usages of
these locals explicit and preventing bugs due to one-sided variable renaming.

This prevents using Kotlin variables as lvalue in JS code.
2021-01-25 19:18:44 +03:00

21 lines
311 B
Kotlin
Vendored

// EXPECTED_REACHABLE_NODES: 1282
// IGNORE_BACKEND: JS_IR
package foo
fun box(): String {
var c: Int = 0
js("""
for (var i = 1; i < 6; i++) {
if (i % 2 === 0) {
continue;
}
c++;
}
""")
assertEquals(3, c)
return "OK"
}