TEST: test includes labeled continue-break
This commit is contained in:
committed by
KonstantinAnisimov
parent
bafa7e7c3c
commit
9afdfc316b
@@ -611,7 +611,7 @@ task unreachable1(type: RunKonanTest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
task break_continue(type: RunKonanTest) {
|
task break_continue(type: RunKonanTest) {
|
||||||
goldValue = "while 2\nwhile 4\nwhile 6\nwhile 2\nwhile 4\nwhile 6\nwhile 1\nwhile 3\nwhile 5\n"
|
goldValue = "foo@l1\nfoo@l2\nfoo@l2\nfoo@l2\nbar@l1\nbar@l2\nbar@l2\nbar@l2\nqux@t1\nqux@l2\nqux@l2\nqux@l2\n"
|
||||||
source = "codegen/controlflow/break.kt"
|
source = "codegen/controlflow/break.kt"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +1,52 @@
|
|||||||
fun foo1() {
|
fun foo() {
|
||||||
var i = 0
|
var i = 0
|
||||||
while (true) {
|
l1@while (true) {
|
||||||
if ((i++ % 2) == 0) continue
|
println("foo@l1")
|
||||||
println("while " + i.toString())
|
try {
|
||||||
if (i > 4) break
|
l2@while (true) {
|
||||||
|
if ((i++ % 2) == 0) continue@l2
|
||||||
|
println("foo@l2")
|
||||||
|
if (i > 4) break@l1
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo2() {
|
fun bar() {
|
||||||
var i = 0
|
var i = 0
|
||||||
do {
|
l1@do {
|
||||||
if ((i++ % 2) == 0) continue
|
try {
|
||||||
println("while " + i.toString())
|
println("bar@l1")
|
||||||
if (i > 4) break
|
throw Exception()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
l2@do {
|
||||||
|
if ((i++ % 2) == 0) continue@l2
|
||||||
|
println("bar@l2")
|
||||||
|
if (i > 4) break@l1
|
||||||
|
} while (true)
|
||||||
|
}
|
||||||
} while (true)
|
} while (true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo3() {
|
fun qux() {
|
||||||
for (i in 1..6) {
|
l1@for (i in 1..6) {
|
||||||
if ((i % 2) == 0) continue
|
t1@try {
|
||||||
println("while " + i.toString())
|
println("qux@t1")
|
||||||
if (i > 4) break
|
throw Exception()
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
l2@ for (j in 1..6) {
|
||||||
|
if ((j % 2) == 0) continue@l2
|
||||||
|
println("qux@l2")
|
||||||
|
if (j > 4) break@l1
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
foo1()
|
foo()
|
||||||
foo2()
|
bar()
|
||||||
foo3()
|
qux()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user