[IR] update testdata: support labels on loops, break & continue

This commit is contained in:
Zalim Bashorov
2020-11-10 03:40:36 +03:00
committed by teamcityserver
parent 9daa86c1a2
commit 5c8a93c7ff
5 changed files with 43 additions and 43 deletions
@@ -4,14 +4,14 @@ fun test1() {
}
fun test2() {
while (true) { // BLOCK
L1@ while (true) { // BLOCK
error("") /* ERROR EXPRESSION */
error("") /* ERROR EXPRESSION */
}
}
fun test3() {
while (true) { // BLOCK
L1@ while (true) { // BLOCK
val lambda: Function0<Nothing> = local fun <anonymous>(): Nothing {
error("") /* ERROR EXPRESSION */
error("") /* ERROR EXPRESSION */
+18 -18
View File
@@ -18,34 +18,34 @@ fun test1() {
}
fun test2() {
while (true) { // BLOCK
while (true) { // BLOCK
break
break
OUTER@ while (true) { // BLOCK
INNER@ while (true) { // BLOCK
break@INNER
break@OUTER
}
break
break@OUTER
}
while (true) { // BLOCK
while (true) { // BLOCK
continue
continue
OUTER@ while (true) { // BLOCK
INNER@ while (true) { // BLOCK
continue@INNER
continue@OUTER
}
continue
continue@OUTER
}
}
fun test3() {
while (true) { // BLOCK
while (true) { // BLOCK
break
L@ while (true) { // BLOCK
L@ while (true) { // BLOCK
break@L
}
break
break@L
}
while (true) { // BLOCK
while (true) { // BLOCK
continue
L@ while (true) { // BLOCK
L@ while (true) { // BLOCK
continue@L
}
continue
continue@L
}
}
@@ -1,6 +1,6 @@
fun test1(c: Boolean?) {
while (true) { // BLOCK
while ({ // BLOCK
L@ while (true) { // BLOCK
L2@ while ({ // BLOCK
val tmp0_elvis_lhs: Boolean? = c
when {
EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> break
@@ -11,8 +11,8 @@ fun test1(c: Boolean?) {
}
fun test2(c: Boolean?) {
while (true) { // BLOCK
while ({ // BLOCK
L@ while (true) { // BLOCK
L2@ while ({ // BLOCK
val tmp0_elvis_lhs: Boolean? = c
when {
EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> continue
@@ -23,7 +23,7 @@ fun test2(c: Boolean?) {
}
fun test3(ss: List<String>?) {
while (true) { // BLOCK
L@ while (true) { // BLOCK
{ // BLOCK
val tmp1_iterator: Iterator<String> = { // BLOCK
val tmp0_elvis_lhs: List<String>? = ss
@@ -32,7 +32,7 @@ fun test3(ss: List<String>?) {
true -> tmp0_elvis_lhs
}
}.iterator()
while (tmp1_iterator.hasNext()) { // BLOCK
L2@ while (tmp1_iterator.hasNext()) { // BLOCK
val s: String = tmp1_iterator.next()
}
}
@@ -40,7 +40,7 @@ fun test3(ss: List<String>?) {
}
fun test4(ss: List<String>?) {
while (true) { // BLOCK
L@ while (true) { // BLOCK
{ // BLOCK
val tmp1_iterator: Iterator<String> = { // BLOCK
val tmp0_elvis_lhs: List<String>? = ss
@@ -49,7 +49,7 @@ fun test4(ss: List<String>?) {
true -> tmp0_elvis_lhs
}
}.iterator()
while (tmp1_iterator.hasNext()) { // BLOCK
L2@ while (tmp1_iterator.hasNext()) { // BLOCK
val s: String = tmp1_iterator.next()
}
}
@@ -58,14 +58,14 @@ fun test4(ss: List<String>?) {
fun test5() {
var i: Int = 0
while (true) { // BLOCK
Outer@ while (true) { // BLOCK
{ // BLOCK
i = i.inc()
i
} /*~> Unit */
var j: Int = 0
{ // BLOCK
do// COMPOSITE {
Inner@ do// COMPOSITE {
{ // BLOCK
j = j.inc()
j
@@ -13,21 +13,21 @@ fun testForBreak1(ss: List<String>) {
fun testForBreak2(ss: List<String>) {
{ // BLOCK
val tmp0_iterator: Iterator<String> = ss.iterator()
while (tmp0_iterator.hasNext()) { // BLOCK
OUTER@ while (tmp0_iterator.hasNext()) { // BLOCK
val s1: String = tmp0_iterator.next()
{ // BLOCK
{ // BLOCK
val tmp1_iterator: Iterator<String> = ss.iterator()
while (tmp1_iterator.hasNext()) { // BLOCK
INNER@ while (tmp1_iterator.hasNext()) { // BLOCK
val s2: String = tmp1_iterator.next()
{ // BLOCK
break
break
break@OUTER
break@INNER
break
}
}
}
break
break@OUTER
}
}
}
@@ -48,21 +48,21 @@ fun testForContinue1(ss: List<String>) {
fun testForContinue2(ss: List<String>) {
{ // BLOCK
val tmp0_iterator: Iterator<String> = ss.iterator()
while (tmp0_iterator.hasNext()) { // BLOCK
OUTER@ while (tmp0_iterator.hasNext()) { // BLOCK
val s1: String = tmp0_iterator.next()
{ // BLOCK
{ // BLOCK
val tmp1_iterator: Iterator<String> = ss.iterator()
while (tmp1_iterator.hasNext()) { // BLOCK
INNER@ while (tmp1_iterator.hasNext()) { // BLOCK
val s2: String = tmp1_iterator.next()
{ // BLOCK
continue
continue
continue@OUTER
continue@INNER
continue
}
}
}
continue
continue@OUTER
}
}
}
+3 -3
View File
@@ -5,16 +5,16 @@ inline fun foo(): Boolean {
fun run(x: Boolean, y: Boolean): String {
var z: Int = 10
{ // BLOCK
do// COMPOSITE {
l2@ do// COMPOSITE {
z = z.plus(other = 1)
when {
greater(arg0 = z, arg1 = 100) -> return "NOT_OK"
}
when {
x -> continue
x -> continue@l2
}
when {
y -> continue
y -> continue@l2
}
// } while (foo())
}