[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() { fun test2() {
while (true) { // BLOCK L1@ while (true) { // BLOCK
error("") /* ERROR EXPRESSION */ error("") /* ERROR EXPRESSION */
error("") /* ERROR EXPRESSION */ error("") /* ERROR EXPRESSION */
} }
} }
fun test3() { fun test3() {
while (true) { // BLOCK L1@ while (true) { // BLOCK
val lambda: Function0<Nothing> = local fun <anonymous>(): Nothing { val lambda: Function0<Nothing> = local fun <anonymous>(): Nothing {
error("") /* ERROR EXPRESSION */ error("") /* ERROR EXPRESSION */
error("") /* ERROR EXPRESSION */ error("") /* ERROR EXPRESSION */
+18 -18
View File
@@ -18,34 +18,34 @@ fun test1() {
} }
fun test2() { fun test2() {
while (true) { // BLOCK OUTER@ while (true) { // BLOCK
while (true) { // BLOCK INNER@ while (true) { // BLOCK
break break@INNER
break break@OUTER
} }
break break@OUTER
} }
while (true) { // BLOCK OUTER@ while (true) { // BLOCK
while (true) { // BLOCK INNER@ while (true) { // BLOCK
continue continue@INNER
continue continue@OUTER
} }
continue continue@OUTER
} }
} }
fun test3() { fun test3() {
while (true) { // BLOCK L@ while (true) { // BLOCK
while (true) { // BLOCK L@ while (true) { // BLOCK
break break@L
} }
break break@L
} }
while (true) { // BLOCK L@ while (true) { // BLOCK
while (true) { // BLOCK L@ while (true) { // BLOCK
continue continue@L
} }
continue continue@L
} }
} }
@@ -1,6 +1,6 @@
fun test1(c: Boolean?) { fun test1(c: Boolean?) {
while (true) { // BLOCK L@ while (true) { // BLOCK
while ({ // BLOCK L2@ while ({ // BLOCK
val tmp0_elvis_lhs: Boolean? = c val tmp0_elvis_lhs: Boolean? = c
when { when {
EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> break EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> break
@@ -11,8 +11,8 @@ fun test1(c: Boolean?) {
} }
fun test2(c: Boolean?) { fun test2(c: Boolean?) {
while (true) { // BLOCK L@ while (true) { // BLOCK
while ({ // BLOCK L2@ while ({ // BLOCK
val tmp0_elvis_lhs: Boolean? = c val tmp0_elvis_lhs: Boolean? = c
when { when {
EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> continue EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> continue
@@ -23,7 +23,7 @@ fun test2(c: Boolean?) {
} }
fun test3(ss: List<String>?) { fun test3(ss: List<String>?) {
while (true) { // BLOCK L@ while (true) { // BLOCK
{ // BLOCK { // BLOCK
val tmp1_iterator: Iterator<String> = { // BLOCK val tmp1_iterator: Iterator<String> = { // BLOCK
val tmp0_elvis_lhs: List<String>? = ss val tmp0_elvis_lhs: List<String>? = ss
@@ -32,7 +32,7 @@ fun test3(ss: List<String>?) {
true -> tmp0_elvis_lhs true -> tmp0_elvis_lhs
} }
}.iterator() }.iterator()
while (tmp1_iterator.hasNext()) { // BLOCK L2@ while (tmp1_iterator.hasNext()) { // BLOCK
val s: String = tmp1_iterator.next() val s: String = tmp1_iterator.next()
} }
} }
@@ -40,7 +40,7 @@ fun test3(ss: List<String>?) {
} }
fun test4(ss: List<String>?) { fun test4(ss: List<String>?) {
while (true) { // BLOCK L@ while (true) { // BLOCK
{ // BLOCK { // BLOCK
val tmp1_iterator: Iterator<String> = { // BLOCK val tmp1_iterator: Iterator<String> = { // BLOCK
val tmp0_elvis_lhs: List<String>? = ss val tmp0_elvis_lhs: List<String>? = ss
@@ -49,7 +49,7 @@ fun test4(ss: List<String>?) {
true -> tmp0_elvis_lhs true -> tmp0_elvis_lhs
} }
}.iterator() }.iterator()
while (tmp1_iterator.hasNext()) { // BLOCK L2@ while (tmp1_iterator.hasNext()) { // BLOCK
val s: String = tmp1_iterator.next() val s: String = tmp1_iterator.next()
} }
} }
@@ -58,14 +58,14 @@ fun test4(ss: List<String>?) {
fun test5() { fun test5() {
var i: Int = 0 var i: Int = 0
while (true) { // BLOCK Outer@ while (true) { // BLOCK
{ // BLOCK { // BLOCK
i = i.inc() i = i.inc()
i i
} /*~> Unit */ } /*~> Unit */
var j: Int = 0 var j: Int = 0
{ // BLOCK { // BLOCK
do// COMPOSITE { Inner@ do// COMPOSITE {
{ // BLOCK { // BLOCK
j = j.inc() j = j.inc()
j j
@@ -13,21 +13,21 @@ fun testForBreak1(ss: List<String>) {
fun testForBreak2(ss: List<String>) { fun testForBreak2(ss: List<String>) {
{ // BLOCK { // BLOCK
val tmp0_iterator: Iterator<String> = ss.iterator() val tmp0_iterator: Iterator<String> = ss.iterator()
while (tmp0_iterator.hasNext()) { // BLOCK OUTER@ while (tmp0_iterator.hasNext()) { // BLOCK
val s1: String = tmp0_iterator.next() val s1: String = tmp0_iterator.next()
{ // BLOCK { // BLOCK
{ // BLOCK { // BLOCK
val tmp1_iterator: Iterator<String> = ss.iterator() val tmp1_iterator: Iterator<String> = ss.iterator()
while (tmp1_iterator.hasNext()) { // BLOCK INNER@ while (tmp1_iterator.hasNext()) { // BLOCK
val s2: String = tmp1_iterator.next() val s2: String = tmp1_iterator.next()
{ // BLOCK { // BLOCK
break break@OUTER
break break@INNER
break break
} }
} }
} }
break break@OUTER
} }
} }
} }
@@ -48,21 +48,21 @@ fun testForContinue1(ss: List<String>) {
fun testForContinue2(ss: List<String>) { fun testForContinue2(ss: List<String>) {
{ // BLOCK { // BLOCK
val tmp0_iterator: Iterator<String> = ss.iterator() val tmp0_iterator: Iterator<String> = ss.iterator()
while (tmp0_iterator.hasNext()) { // BLOCK OUTER@ while (tmp0_iterator.hasNext()) { // BLOCK
val s1: String = tmp0_iterator.next() val s1: String = tmp0_iterator.next()
{ // BLOCK { // BLOCK
{ // BLOCK { // BLOCK
val tmp1_iterator: Iterator<String> = ss.iterator() val tmp1_iterator: Iterator<String> = ss.iterator()
while (tmp1_iterator.hasNext()) { // BLOCK INNER@ while (tmp1_iterator.hasNext()) { // BLOCK
val s2: String = tmp1_iterator.next() val s2: String = tmp1_iterator.next()
{ // BLOCK { // BLOCK
continue continue@OUTER
continue continue@INNER
continue continue
} }
} }
} }
continue continue@OUTER
} }
} }
} }
+3 -3
View File
@@ -5,16 +5,16 @@ inline fun foo(): Boolean {
fun run(x: Boolean, y: Boolean): String { fun run(x: Boolean, y: Boolean): String {
var z: Int = 10 var z: Int = 10
{ // BLOCK { // BLOCK
do// COMPOSITE { l2@ do// COMPOSITE {
z = z.plus(other = 1) z = z.plus(other = 1)
when { when {
greater(arg0 = z, arg1 = 100) -> return "NOT_OK" greater(arg0 = z, arg1 = 100) -> return "NOT_OK"
} }
when { when {
x -> continue x -> continue@l2
} }
when { when {
y -> continue y -> continue@l2
} }
// } while (foo()) // } while (foo())
} }