JS: translate when to JsSwitch when possible

See KT-21160
This commit is contained in:
Alexey Andreev
2017-11-09 19:14:01 +03:00
parent 7b403211dd
commit 678b4c67c1
21 changed files with 250 additions and 24 deletions
@@ -0,0 +1,31 @@
fun box(x: Int) {
println(
when (
x
) {
one(),
two(),
three() ->
55
four(),
five() ->
66
else ->
77
}
)
}
fun one() = 1
fun two() = 2
fun three() = 3
fun four() = 4
fun five() = 5
// LINES: 19 4 4 3 6 4 6 4 7 4 8 9 9 11 4 11 4 12 13 13 16 16 2 21 21 21 23 23 23 25 25 25 27 27 27 29 29 29