[FIR2IR] Don't set WHILE_LOOP origin for blocks
This commit is contained in:
committed by
teamcityserver
parent
eb9b5da82b
commit
ef6b643b9c
@@ -873,7 +873,8 @@ class Fir2IrVisitor(
|
||||
loopMap[whileLoop] = this
|
||||
label = whileLoop.label?.name
|
||||
condition = convertToIrExpression(whileLoop.condition)
|
||||
body = whileLoop.block.convertToIrExpressionOrBlock(origin)
|
||||
// NB: here we have strange origin logic, made to be compatible with FE 1.0
|
||||
body = whileLoop.block.convertToIrExpressionOrBlock(origin.takeIf { it != IrStatementOrigin.WHILE_LOOP })
|
||||
loopMap.remove(whileLoop)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,14 +7,14 @@ FILE fqName:<root> fileName:/badBreakContinue.kt
|
||||
BLOCK_BODY
|
||||
WHILE label=L1 origin=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value=true
|
||||
body: BLOCK type=kotlin.Nothing origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Nothing origin=null
|
||||
ERROR_EXPR 'Unbound loop: break@@@[ERROR_EXPR(Cannot bind label ERROR to a loop)] ' type=kotlin.Nothing
|
||||
ERROR_EXPR 'Unbound loop: continue@@@[ERROR_EXPR(Cannot bind label ERROR to a loop)] ' type=kotlin.Nothing
|
||||
FUN name:test3 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
WHILE label=L1 origin=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value=true
|
||||
body: BLOCK type=kotlin.Unit origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Unit origin=null
|
||||
VAR name:lambda type:kotlin.Function0<kotlin.Nothing> [val]
|
||||
FUN_EXPR type=kotlin.Function0<kotlin.Nothing> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Nothing
|
||||
@@ -25,7 +25,7 @@ FILE fqName:<root> fileName:/badBreakContinue.kt
|
||||
BLOCK_BODY
|
||||
WHILE label=null origin=WHILE_LOOP
|
||||
condition: ERROR_EXPR 'Unbound loop: break@@@[ERROR_EXPR(Cannot bind unlabeled jump to a loop)] ' type=kotlin.Nothing
|
||||
body: BLOCK type=kotlin.Unit origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Unit origin=null
|
||||
WHILE label=null origin=WHILE_LOOP
|
||||
condition: ERROR_EXPR 'Unbound loop: continue@@@[ERROR_EXPR(Cannot bind unlabeled jump to a loop)] ' type=kotlin.Nothing
|
||||
body: BLOCK type=kotlin.Unit origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Unit origin=null
|
||||
|
||||
@@ -17,19 +17,19 @@ FILE fqName:<root> fileName:/breakContinue.kt
|
||||
BLOCK_BODY
|
||||
WHILE label=OUTER origin=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value=true
|
||||
body: BLOCK type=kotlin.Nothing origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Nothing origin=null
|
||||
WHILE label=INNER origin=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value=true
|
||||
body: BLOCK type=kotlin.Nothing origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Nothing origin=null
|
||||
BREAK label=INNER loop.label=INNER
|
||||
BREAK label=OUTER loop.label=OUTER
|
||||
BREAK label=OUTER loop.label=OUTER
|
||||
WHILE label=OUTER origin=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value=true
|
||||
body: BLOCK type=kotlin.Nothing origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Nothing origin=null
|
||||
WHILE label=INNER origin=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value=true
|
||||
body: BLOCK type=kotlin.Nothing origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Nothing origin=null
|
||||
CONTINUE label=INNER loop.label=INNER
|
||||
CONTINUE label=OUTER loop.label=OUTER
|
||||
CONTINUE label=OUTER loop.label=OUTER
|
||||
@@ -37,14 +37,14 @@ FILE fqName:<root> fileName:/breakContinue.kt
|
||||
BLOCK_BODY
|
||||
WHILE label=L origin=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value=true
|
||||
body: BLOCK type=kotlin.Nothing origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Nothing origin=null
|
||||
WHILE label=L origin=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value=true
|
||||
body: BREAK label=L loop.label=L
|
||||
BREAK label=L loop.label=L
|
||||
WHILE label=L origin=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value=true
|
||||
body: BLOCK type=kotlin.Nothing origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Nothing origin=null
|
||||
WHILE label=L origin=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value=true
|
||||
body: CONTINUE label=L loop.label=L
|
||||
|
||||
@@ -4,7 +4,7 @@ FILE fqName:<root> fileName:/breakContinueInLoopHeader.kt
|
||||
BLOCK_BODY
|
||||
WHILE label=L origin=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value=true
|
||||
body: BLOCK type=kotlin.Unit origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Unit origin=null
|
||||
WHILE label=L2 origin=WHILE_LOOP
|
||||
condition: BLOCK type=kotlin.Boolean origin=ELVIS
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Boolean? [val]
|
||||
@@ -19,13 +19,13 @@ FILE fqName:<root> fileName:/breakContinueInLoopHeader.kt
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: TYPE_OP type=kotlin.Boolean origin=IMPLICIT_CAST typeOperand=kotlin.Boolean
|
||||
GET_VAR 'val tmp_0: kotlin.Boolean? [val] declared in <root>.test1' type=kotlin.Boolean? origin=null
|
||||
body: BLOCK type=kotlin.Unit origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Unit origin=null
|
||||
FUN name:test2 visibility:public modality:FINAL <> (c:kotlin.Boolean?) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:c index:0 type:kotlin.Boolean?
|
||||
BLOCK_BODY
|
||||
WHILE label=L origin=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value=true
|
||||
body: BLOCK type=kotlin.Unit origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Unit origin=null
|
||||
WHILE label=L2 origin=WHILE_LOOP
|
||||
condition: BLOCK type=kotlin.Boolean origin=ELVIS
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Boolean? [val]
|
||||
@@ -40,13 +40,13 @@ FILE fqName:<root> fileName:/breakContinueInLoopHeader.kt
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: TYPE_OP type=kotlin.Boolean origin=IMPLICIT_CAST typeOperand=kotlin.Boolean
|
||||
GET_VAR 'val tmp_1: kotlin.Boolean? [val] declared in <root>.test2' type=kotlin.Boolean? origin=null
|
||||
body: BLOCK type=kotlin.Unit origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Unit origin=null
|
||||
FUN name:test3 visibility:public modality:FINAL <> (ss:kotlin.collections.List<kotlin.String>?) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:ss index:0 type:kotlin.collections.List<kotlin.String>?
|
||||
BLOCK_BODY
|
||||
WHILE label=L origin=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value=true
|
||||
body: BLOCK type=kotlin.Unit origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Unit origin=null
|
||||
BLOCK type=kotlin.Unit origin=FOR_LOOP
|
||||
VAR FOR_LOOP_ITERATOR name:tmp_2 type:kotlin.collections.Iterator<kotlin.String> [val]
|
||||
CALL 'public abstract fun iterator (): kotlin.collections.Iterator<E of kotlin.collections.List> [operator] declared in kotlin.collections.List' type=kotlin.collections.Iterator<kotlin.String> origin=FOR_LOOP_ITERATOR
|
||||
@@ -75,7 +75,7 @@ FILE fqName:<root> fileName:/breakContinueInLoopHeader.kt
|
||||
BLOCK_BODY
|
||||
WHILE label=L origin=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value=true
|
||||
body: BLOCK type=kotlin.Unit origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Unit origin=null
|
||||
BLOCK type=kotlin.Unit origin=FOR_LOOP
|
||||
VAR FOR_LOOP_ITERATOR name:tmp_4 type:kotlin.collections.Iterator<kotlin.String> [val]
|
||||
CALL 'public abstract fun iterator (): kotlin.collections.Iterator<E of kotlin.collections.List> [operator] declared in kotlin.collections.List' type=kotlin.collections.Iterator<kotlin.String> origin=FOR_LOOP_ITERATOR
|
||||
@@ -105,7 +105,7 @@ FILE fqName:<root> fileName:/breakContinueInLoopHeader.kt
|
||||
CONST Int type=kotlin.Int value=0
|
||||
WHILE label=Outer origin=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value=true
|
||||
body: BLOCK type=kotlin.Unit origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Unit origin=null
|
||||
SET_VAR 'var i: kotlin.Int [var] declared in <root>.test5' type=kotlin.Unit origin=EQ
|
||||
CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||
$this: GET_VAR 'var i: kotlin.Int [var] declared in <root>.test5' type=kotlin.Int origin=null
|
||||
|
||||
@@ -7,7 +7,7 @@ FILE fqName:<root> fileName:/whileDoWhile.kt
|
||||
condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
|
||||
arg0: GET_VAR 'var x: kotlin.Int [var] declared in <root>.test' type=kotlin.Int origin=null
|
||||
arg1: CONST Int type=kotlin.Int value=0
|
||||
body: BLOCK type=kotlin.Unit origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Unit origin=null
|
||||
WHILE label=null origin=WHILE_LOOP
|
||||
condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
|
||||
arg0: GET_VAR 'var x: kotlin.Int [var] declared in <root>.test' type=kotlin.Int origin=null
|
||||
@@ -23,7 +23,7 @@ FILE fqName:<root> fileName:/whileDoWhile.kt
|
||||
condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
|
||||
arg0: GET_VAR 'var x: kotlin.Int [var] declared in <root>.test' type=kotlin.Int origin=null
|
||||
arg1: CONST Int type=kotlin.Int value=10
|
||||
body: BLOCK type=kotlin.Int origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Int origin=null
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val]
|
||||
GET_VAR 'var x: kotlin.Int [var] declared in <root>.test' type=kotlin.Int origin=null
|
||||
SET_VAR 'var x: kotlin.Int [var] declared in <root>.test' type=kotlin.Unit origin=EQ
|
||||
@@ -69,7 +69,7 @@ FILE fqName:<root> fileName:/whileDoWhile.kt
|
||||
WHILE label=null origin=WHILE_LOOP
|
||||
condition: TYPE_OP type=kotlin.Boolean origin=IMPLICIT_CAST typeOperand=kotlin.Boolean
|
||||
GET_VAR 'val a: kotlin.Any? [val] declared in <root>.testSmartcastInCondition' type=kotlin.Any? origin=null
|
||||
body: BLOCK type=kotlin.Unit origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Unit origin=null
|
||||
DO_WHILE label=null origin=DO_WHILE_LOOP
|
||||
body: COMPOSITE type=kotlin.Unit origin=DO_WHILE_LOOP
|
||||
condition: TYPE_OP type=kotlin.Boolean origin=IMPLICIT_CAST typeOperand=kotlin.Boolean
|
||||
|
||||
@@ -12,7 +12,7 @@ FILE fqName:<root> fileName:/coercionInLoop.kt
|
||||
WHILE label=null origin=WHILE_LOOP
|
||||
condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=null
|
||||
$this: GET_VAR 'val x: kotlin.collections.DoubleIterator [val] declared in <root>.box' type=kotlin.collections.DoubleIterator origin=null
|
||||
body: BLOCK type=kotlin.Int origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Int origin=null
|
||||
WHEN type=kotlin.Unit origin=IF
|
||||
BRANCH
|
||||
if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ FILE fqName:<root> fileName:/enhancedNullabilityInForLoop.kt
|
||||
WHILE label=null origin=WHILE_LOOP
|
||||
condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=null
|
||||
$this: GET_VAR 'val iterator: kotlin.collections.MutableIterator<<root>.P?> [val] declared in <root>.testDesugaredForInList' type=kotlin.collections.MutableIterator<<root>.P?> origin=null
|
||||
body: BLOCK type=kotlin.Unit origin=WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Unit origin=null
|
||||
VAR name:x type:<root>.P? [val]
|
||||
CALL 'public abstract fun next (): T of kotlin.collections.MutableIterator [fake_override,operator] declared in kotlin.collections.MutableIterator' type=<root>.P? origin=null
|
||||
$this: GET_VAR 'val iterator: kotlin.collections.MutableIterator<<root>.P?> [val] declared in <root>.testDesugaredForInList' type=kotlin.collections.MutableIterator<<root>.P?> origin=null
|
||||
|
||||
Reference in New Issue
Block a user