[KT-7683] Implement translation of 'when .. in' clause to JS

This commit is contained in:
Alexey Andreev
2016-02-03 16:23:52 +03:00
parent 6ee4071462
commit e9d5d8f0fe
9 changed files with 250 additions and 9 deletions
@@ -0,0 +1,16 @@
// see KT-7683
// WhenTranslator must recognize KtWhenConditionInRange for when statement
package foo
fun box(): String {
var result = testFun(-1) + testFun(5) + testFun(50) + testFun(150)
return if (result == "[miss][hit1][miss][hit2]") "OK" else "fail"
}
fun testFun(index: Int): String {
var r = "[miss]"
when (index) {
in 0..9 -> r = "[hit1]"
in 100..200 -> r = "[hit2]"
}
return r;
}