JS backend: remove dangerous package, correct translation for call, assignments, binary operations, support try...catch as expression

#KT-5576 Fixed
 #KT-5594 Fixed
 #KT-3166 Fixed
 #KT-5545 Fixed
 #KT-5594 Fixed
 #KT-5258 Fixed

JS backend: fix KT-4879: extra side effect when use when in default arguments

 #KT-4879 Fixed

JS backend: improve and fix WhenTranslator, fix order of evaluation for condtitions, fix KT-5263 (JS: extra tmp when initialize val in when by expression with if)

 #KT-5263 Fixed
This commit is contained in:
Michael Nedzelsky
2014-08-12 22:52:41 +04:00
parent 629d9a275b
commit 53f0e6dcd2
56 changed files with 1454 additions and 667 deletions
@@ -0,0 +1,29 @@
// Order of evaluation differs for JVM and Javascript backend
// http://youtrack.jetbrains.com/issue/KT-5254
package foo
var s = ""
fun a():String {
s += "A"
return ""
}
fun b():String {
s += "B"
return ""
}
fun c():String {
s += "C"
return ""
}
fun box(): String {
var res = (if(true) {a()} else "") + b() + (if (true) {c()} else "")
assertEquals("ABC", s)
return "OK"
}