Generate do-while condition within loop body scope

This commit is contained in:
Dmitry Petrov
2017-05-04 13:38:59 +03:00
parent fdb4de355c
commit 8e84862afa
6 changed files with 116 additions and 34 deletions
@@ -1,23 +1,35 @@
fun test1(c: Boolean?) {
L@ while (true) {
while (c ?: break)
L2@while (c ?: break)
}
}
fun test2(c: Boolean?) {
L@ while (true) {
while (c ?: continue)
L2@while (c ?: continue)
}
}
fun test3(ss: List<String>?) {
L@ while (true) {
for (s in ss ?: continue)
L2@for (s in ss ?: continue)
}
}
fun test4(ss: List<String>?) {
L@ while (true) {
for (s in ss ?: break)
L2@for (s in ss ?: break)
}
}
fun test5() {
var i = 0
Outer@while (true) {
++i
var j = 0
Inner@do {
++j
} while (if (j >= 3) false else break) // break@Inner
if (i == 3) break
}
}