FIR2IR: wrap do-while loop in IrBlock

"so that variables declared in loop body are not visible outside of the
loop" (from commit d096f1d)
This commit is contained in:
Jinseong Jeon
2021-03-18 00:29:09 -07:00
committed by TeamCityServer
parent 08670114c8
commit 7898d167f3
13 changed files with 197 additions and 161 deletions
@@ -1,5 +1,7 @@
fun foo() {
do// COMPOSITE {
val x: Int = 42
// } while (EQEQ(arg0 = x, arg1 = 42).not())
{ // BLOCK
do// COMPOSITE {
val x: Int = 42
// } while (EQEQ(arg0 = x, arg1 = 42).not())
}
}
@@ -1,11 +1,12 @@
FILE fqName:<root> fileName:/localVarInDoWhile.kt
FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
DO_WHILE label=null origin=DO_WHILE_LOOP
body: COMPOSITE type=kotlin.Unit origin=DO_WHILE_LOOP
VAR name:x type:kotlin.Int [val]
CONST Int type=kotlin.Int value=42
condition: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: GET_VAR 'val x: kotlin.Int [val] declared in <root>.foo' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=42
BLOCK type=kotlin.Unit origin=null
DO_WHILE label=null origin=DO_WHILE_LOOP
body: COMPOSITE type=kotlin.Unit origin=DO_WHILE_LOOP
VAR name:x type:kotlin.Int [val]
CONST Int type=kotlin.Int value=42
condition: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: GET_VAR 'val x: kotlin.Int [val] declared in <root>.foo' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=42