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:
@@ -0,0 +1,23 @@
|
||||
package foo
|
||||
|
||||
var global: String = ""
|
||||
|
||||
fun bar(s: String, value: Int): Int {
|
||||
global += s
|
||||
return value
|
||||
}
|
||||
|
||||
fun baz(vararg args: Int): String {
|
||||
return "baz: ${args.size}"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
baz(bar("A", 10), try { global += "B"; 20} finally {})
|
||||
assertEquals("AB", global)
|
||||
|
||||
global = ""
|
||||
baz(bar("A", 10), 30, if (true) { while(false){}; global+= "B"; 20 } else { 50 })
|
||||
assertEquals("AB", global)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user