JS: fix translation of augmented assignment when RHS changes value of LHS

This commit is contained in:
Alexey Andreev
2016-11-21 18:47:09 +03:00
parent be196789d2
commit 40e00a62f5
7 changed files with 77 additions and 13 deletions
@@ -1,9 +1,6 @@
// WITH_RUNTIME
// NO_INTERCEPT_RESUME_TESTS
// TODO: fix bug in JVM backend and remove this directive
// TARGET_BACKEND: JS
class Controller {
var result = ""
@@ -29,7 +26,7 @@ fun box(): String {
}
}
}
if (value != "A;[B][C]!") return "fail: suspend as if condition: $value"
if (value != "A;B]C]!") return "fail: suspend as if condition: $value"
return "OK"
}
@@ -0,0 +1,23 @@
// WITH_RUNTIME
import kotlin.test.*
var log = ""
var result = 20
fun <T> id(value: T) = value
fun box(): String {
result += if (id("true") == "true") {
result += 10
log += "true chosen"
3
}
else {
4
}
assertEquals(23, result)
assertEquals("true chosen", log)
return "OK"
}