[FIR2IR] Fix conversion of loops with withIndex
This commit is contained in:
committed by
TeamCityServer
parent
a2ec99e38c
commit
b4fada82ae
@@ -67,6 +67,7 @@ FILE fqName:<root> fileName:/breakContinueInLoopHeader.kt
|
||||
VAR FOR_LOOP_VARIABLE name:s type:kotlin.String [val]
|
||||
CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT
|
||||
$this: GET_VAR 'val tmp_2: kotlin.collections.Iterator<kotlin.String> [val] declared in <root>.test3' type=kotlin.collections.Iterator<kotlin.String> origin=null
|
||||
BLOCK type=kotlin.Unit origin=null
|
||||
FUN name:test4 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
|
||||
@@ -95,6 +96,7 @@ FILE fqName:<root> fileName:/breakContinueInLoopHeader.kt
|
||||
VAR FOR_LOOP_VARIABLE name:s type:kotlin.String [val]
|
||||
CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT
|
||||
$this: GET_VAR 'val tmp_4: kotlin.collections.Iterator<kotlin.String> [val] declared in <root>.test4' type=kotlin.collections.Iterator<kotlin.String> origin=null
|
||||
BLOCK type=kotlin.Unit origin=null
|
||||
FUN name:test5 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR name:i type:kotlin.Int [var]
|
||||
|
||||
@@ -36,6 +36,8 @@ fun test3(ss: List<String>?) {
|
||||
}.iterator()
|
||||
L2@ while (<iterator>.hasNext()) { // BLOCK
|
||||
val s: String = <iterator>.next()
|
||||
{ // BLOCK
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,6 +55,8 @@ fun test4(ss: List<String>?) {
|
||||
}.iterator()
|
||||
L2@ while (<iterator>.hasNext()) { // BLOCK
|
||||
val s: String = <iterator>.next()
|
||||
{ // BLOCK
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,3 +82,4 @@ fun test5() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,10 +55,10 @@ FILE fqName:<root> fileName:/destructuring1.kt
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.A [val]
|
||||
GET_OBJECT 'CLASS OBJECT name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.A
|
||||
VAR name:x type:kotlin.Int [val]
|
||||
CALL 'public final fun component1 (): kotlin.Int [operator] declared in <root>.B' type=kotlin.Int origin=null
|
||||
CALL 'public final fun component1 (): kotlin.Int [operator] declared in <root>.B' type=kotlin.Int origin=COMPONENT_N(index=1)
|
||||
$this: GET_VAR '<this>: <root>.B declared in <root>.test' type=<root>.B origin=null
|
||||
$receiver: GET_VAR 'val tmp_0: <root>.A [val] declared in <root>.test' type=<root>.A origin=null
|
||||
VAR name:y type:kotlin.Int [val]
|
||||
CALL 'public final fun component2 (): kotlin.Int [operator] declared in <root>.B' type=kotlin.Int origin=null
|
||||
CALL 'public final fun component2 (): kotlin.Int [operator] declared in <root>.B' type=kotlin.Int origin=COMPONENT_N(index=2)
|
||||
$this: GET_VAR '<this>: <root>.B declared in <root>.test' type=<root>.B origin=null
|
||||
$receiver: GET_VAR 'val tmp_0: <root>.A [val] declared in <root>.test' type=<root>.A origin=null
|
||||
|
||||
+2
-2
@@ -61,10 +61,10 @@ FILE fqName:<root> fileName:/destructuringWithUnderscore.kt
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.A [val]
|
||||
GET_OBJECT 'CLASS OBJECT name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.A
|
||||
VAR name:x type:kotlin.Int [val]
|
||||
CALL 'public final fun component1 (): kotlin.Int [operator] declared in <root>.B' type=kotlin.Int origin=null
|
||||
CALL 'public final fun component1 (): kotlin.Int [operator] declared in <root>.B' type=kotlin.Int origin=COMPONENT_N(index=1)
|
||||
$this: GET_VAR '<this>: <root>.B declared in <root>.test' type=<root>.B origin=null
|
||||
$receiver: GET_VAR 'val tmp_0: <root>.A [val] declared in <root>.test' type=<root>.A origin=null
|
||||
VAR name:z type:kotlin.Int [val]
|
||||
CALL 'public final fun component3 (): kotlin.Int [operator] declared in <root>.B' type=kotlin.Int origin=null
|
||||
CALL 'public final fun component3 (): kotlin.Int [operator] declared in <root>.B' type=kotlin.Int origin=COMPONENT_N(index=3)
|
||||
$this: GET_VAR '<this>: <root>.B declared in <root>.test' type=<root>.B origin=null
|
||||
$receiver: GET_VAR 'val tmp_0: <root>.A [val] declared in <root>.test' type=<root>.A origin=null
|
||||
|
||||
+12
-10
@@ -13,6 +13,7 @@ FILE fqName:<root> fileName:/for.kt
|
||||
VAR FOR_LOOP_VARIABLE name:s type:kotlin.String [val]
|
||||
CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=kotlin.String origin=FOR_LOOP_NEXT
|
||||
$this: GET_VAR 'val tmp_0: kotlin.collections.Iterator<kotlin.String> [val] declared in <root>.testEmpty' type=kotlin.collections.Iterator<kotlin.String> origin=null
|
||||
BLOCK type=kotlin.Unit origin=null
|
||||
FUN name:testIterable 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
|
||||
@@ -40,16 +41,16 @@ FILE fqName:<root> fileName:/for.kt
|
||||
condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT
|
||||
$this: GET_VAR 'val tmp_2: kotlin.collections.Iterator<kotlin.Pair<kotlin.Int, kotlin.String>> [val] declared in <root>.testDestructuring' type=kotlin.collections.Iterator<kotlin.Pair<kotlin.Int, kotlin.String>> origin=null
|
||||
body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE
|
||||
VAR FOR_LOOP_VARIABLE name:<destruct> type:kotlin.Pair<kotlin.Int, kotlin.String> [val]
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.Pair<kotlin.Int, kotlin.String> [val]
|
||||
CALL 'public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator' type=kotlin.Pair<kotlin.Int, kotlin.String> origin=FOR_LOOP_NEXT
|
||||
$this: GET_VAR 'val tmp_2: kotlin.collections.Iterator<kotlin.Pair<kotlin.Int, kotlin.String>> [val] declared in <root>.testDestructuring' type=kotlin.collections.Iterator<kotlin.Pair<kotlin.Int, kotlin.String>> origin=null
|
||||
VAR name:i type:kotlin.Int [val]
|
||||
CALL 'public final fun component1 (): A of kotlin.Pair [operator] declared in kotlin.Pair' type=kotlin.Int origin=COMPONENT_N(index=1)
|
||||
$this: GET_VAR 'val tmp_3: kotlin.Pair<kotlin.Int, kotlin.String> [val] declared in <root>.testDestructuring' type=kotlin.Pair<kotlin.Int, kotlin.String> origin=null
|
||||
VAR name:s type:kotlin.String [val]
|
||||
CALL 'public final fun component2 (): B of kotlin.Pair [operator] declared in kotlin.Pair' type=kotlin.String origin=COMPONENT_N(index=2)
|
||||
$this: GET_VAR 'val tmp_3: kotlin.Pair<kotlin.Int, kotlin.String> [val] declared in <root>.testDestructuring' type=kotlin.Pair<kotlin.Int, kotlin.String> origin=null
|
||||
BLOCK type=kotlin.Unit origin=null
|
||||
VAR name:i type:kotlin.Int [val]
|
||||
CALL 'public final fun component1 (): A of kotlin.Pair [operator] declared in kotlin.Pair' type=kotlin.Int origin=null
|
||||
$this: GET_VAR 'val <destruct>: kotlin.Pair<kotlin.Int, kotlin.String> [val] declared in <root>.testDestructuring' type=kotlin.Pair<kotlin.Int, kotlin.String> origin=null
|
||||
VAR name:s type:kotlin.String [val]
|
||||
CALL 'public final fun component2 (): B of kotlin.Pair [operator] declared in kotlin.Pair' type=kotlin.String origin=null
|
||||
$this: GET_VAR 'val <destruct>: kotlin.Pair<kotlin.Int, kotlin.String> [val] declared in <root>.testDestructuring' type=kotlin.Pair<kotlin.Int, kotlin.String> origin=null
|
||||
CALL 'public final fun println (message: kotlin.Int): kotlin.Unit [inline] declared in kotlin.io.ConsoleKt' type=kotlin.Unit origin=null
|
||||
message: GET_VAR 'val i: kotlin.Int [val] declared in <root>.testDestructuring' type=kotlin.Int origin=null
|
||||
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit [inline] declared in kotlin.io.ConsoleKt' type=kotlin.Unit origin=null
|
||||
@@ -57,15 +58,16 @@ FILE fqName:<root> fileName:/for.kt
|
||||
FUN name:testRange visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
BLOCK type=kotlin.Unit origin=FOR_LOOP
|
||||
VAR FOR_LOOP_ITERATOR name:tmp_3 type:kotlin.collections.IntIterator [val]
|
||||
VAR FOR_LOOP_ITERATOR name:tmp_4 type:kotlin.collections.IntIterator [val]
|
||||
CALL 'public open fun iterator (): kotlin.collections.IntIterator [operator] declared in kotlin.ranges.IntProgression' type=kotlin.collections.IntIterator origin=FOR_LOOP_ITERATOR
|
||||
$this: CALL 'public final fun rangeTo (other: kotlin.Int): kotlin.ranges.IntRange [operator] declared in kotlin.Int' type=kotlin.ranges.IntRange origin=RANGE
|
||||
$this: CONST Int type=kotlin.Int value=1
|
||||
other: CONST Int type=kotlin.Int value=10
|
||||
WHILE label=null origin=FOR_LOOP_INNER_WHILE
|
||||
condition: CALL 'public abstract fun hasNext (): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.IntIterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT
|
||||
$this: GET_VAR 'val tmp_3: kotlin.collections.IntIterator [val] declared in <root>.testRange' type=kotlin.collections.IntIterator origin=null
|
||||
$this: GET_VAR 'val tmp_4: kotlin.collections.IntIterator [val] declared in <root>.testRange' type=kotlin.collections.IntIterator origin=null
|
||||
body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE
|
||||
VAR FOR_LOOP_VARIABLE name:i type:kotlin.Int [val]
|
||||
CALL 'public final fun next (): kotlin.Int [operator] declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT
|
||||
$this: GET_VAR 'val tmp_3: kotlin.collections.IntIterator [val] declared in <root>.testRange' type=kotlin.collections.IntIterator origin=null
|
||||
$this: GET_VAR 'val tmp_4: kotlin.collections.IntIterator [val] declared in <root>.testRange' type=kotlin.collections.IntIterator origin=null
|
||||
BLOCK type=kotlin.Unit origin=null
|
||||
|
||||
+7
-2
@@ -3,6 +3,8 @@ fun testEmpty(ss: List<String>) {
|
||||
val <iterator>: Iterator<String> = ss.iterator()
|
||||
while (<iterator>.hasNext()) { // BLOCK
|
||||
val s: String = <iterator>.next()
|
||||
{ // BLOCK
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,9 +24,9 @@ fun testDestructuring(pp: List<Pair<Int, String>>) {
|
||||
val <iterator>: Iterator<Pair<Int, String>> = pp.iterator()
|
||||
while (<iterator>.hasNext()) { // BLOCK
|
||||
val <destruct>: Pair<Int, String> = <iterator>.next()
|
||||
val i: Int = <destruct>.component1()
|
||||
val s: String = <destruct>.component2()
|
||||
{ // BLOCK
|
||||
val i: Int = <destruct>.component1()
|
||||
val s: String = <destruct>.component2()
|
||||
println(message = i)
|
||||
println(message = s)
|
||||
}
|
||||
@@ -37,6 +39,9 @@ fun testRange() {
|
||||
val <iterator>: IntIterator = 1.rangeTo(other = 10).iterator()
|
||||
while (<iterator>.hasNext()) { // BLOCK
|
||||
val i: Int = <iterator>.next()
|
||||
{ // BLOCK
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -14,9 +14,9 @@ FILE fqName:<root> fileName:/implicitNotNullInDestructuringAssignment.kt
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:@[FlexibleNullability] <root>.J? [val]
|
||||
CALL 'public open fun j (): @[FlexibleNullability] <root>.J? declared in <root>.J' type=@[FlexibleNullability] <root>.J? origin=null
|
||||
VAR name:a type:kotlin.Int [val]
|
||||
CALL 'public final fun component1 (): kotlin.Int [operator] declared in <root>' type=kotlin.Int origin=null
|
||||
CALL 'public final fun component1 (): kotlin.Int [operator] declared in <root>' type=kotlin.Int origin=COMPONENT_N(index=1)
|
||||
$receiver: GET_VAR 'val tmp_0: @[FlexibleNullability] <root>.J? [val] declared in <root>.test' type=@[FlexibleNullability] <root>.J? origin=null
|
||||
VAR name:b type:kotlin.Int [val]
|
||||
CALL 'private final fun component2 (): kotlin.Int [operator] declared in <root>' type=kotlin.Int origin=null
|
||||
CALL 'private final fun component2 (): kotlin.Int [operator] declared in <root>' type=kotlin.Int origin=COMPONENT_N(index=2)
|
||||
$receiver: TYPE_OP type=@[FlexibleNullability] <root>.J origin=IMPLICIT_NOTNULL typeOperand=@[FlexibleNullability] <root>.J
|
||||
GET_VAR 'val tmp_0: @[FlexibleNullability] <root>.J? [val] declared in <root>.test' type=@[FlexibleNullability] <root>.J? origin=null
|
||||
|
||||
@@ -53,11 +53,11 @@ FILE fqName:<root> fileName:/multipleSmartCasts.kt
|
||||
TYPE_OP type=<root>.IC1 origin=IMPLICIT_CAST typeOperand=<root>.IC1
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
|
||||
VAR name:x1 type:kotlin.Int [val]
|
||||
CALL 'public abstract fun component1 (): kotlin.Int [operator] declared in <root>.IC1' type=kotlin.Int origin=null
|
||||
CALL 'public abstract fun component1 (): kotlin.Int [operator] declared in <root>.IC1' type=kotlin.Int origin=COMPONENT_N(index=1)
|
||||
$this: TYPE_OP type=<root>.IC1 origin=IMPLICIT_CAST typeOperand=<root>.IC1
|
||||
GET_VAR 'val tmp_0: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
|
||||
VAR name:x2 type:kotlin.String [val]
|
||||
CALL 'public abstract fun component2 (): kotlin.String [operator] declared in <root>.IC2' type=kotlin.String origin=null
|
||||
CALL 'public abstract fun component2 (): kotlin.String [operator] declared in <root>.IC2' type=kotlin.String origin=COMPONENT_N(index=2)
|
||||
$this: TYPE_OP type=<root>.IC2 origin=IMPLICIT_CAST typeOperand=<root>.IC2
|
||||
TYPE_OP type=<root>.IC1 origin=IMPLICIT_CAST typeOperand=<root>.IC1
|
||||
GET_VAR 'val tmp_0: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
|
||||
|
||||
+2
-2
@@ -52,10 +52,10 @@ FILE fqName:<root> fileName:/smartCastsWithDestructuring.kt
|
||||
TYPE_OP type=<root>.I2 origin=IMPLICIT_CAST typeOperand=<root>.I2
|
||||
GET_VAR 'x: <root>.I1 declared in <root>.test' type=<root>.I1 origin=null
|
||||
VAR name:c1 type:kotlin.Int [val]
|
||||
CALL 'public final fun component1 (): kotlin.Int [operator] declared in <root>' type=kotlin.Int origin=null
|
||||
CALL 'public final fun component1 (): kotlin.Int [operator] declared in <root>' type=kotlin.Int origin=COMPONENT_N(index=1)
|
||||
$receiver: TYPE_OP type=<root>.I2 origin=IMPLICIT_CAST typeOperand=<root>.I2
|
||||
GET_VAR 'val tmp_0: <root>.I1 [val] declared in <root>.test' type=<root>.I1 origin=null
|
||||
VAR name:c2 type:kotlin.String [val]
|
||||
CALL 'public final fun component2 (): kotlin.String [operator] declared in <root>' type=kotlin.String origin=null
|
||||
CALL 'public final fun component2 (): kotlin.String [operator] declared in <root>' type=kotlin.String origin=COMPONENT_N(index=2)
|
||||
$receiver: TYPE_OP type=<root>.I2 origin=IMPLICIT_CAST typeOperand=<root>.I2
|
||||
GET_VAR 'val tmp_0: <root>.I1 [val] declared in <root>.test' type=<root>.I1 origin=null
|
||||
|
||||
Reference in New Issue
Block a user