Add IR for-in-range test

This commit is contained in:
Mikhail Glukhikh
2019-05-16 15:42:41 +03:00
parent 139557e641
commit 728459a504
3 changed files with 34 additions and 1 deletions
+16 -1
View File
@@ -56,4 +56,19 @@ FILE fqName:<root> fileName:/for.kt
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' type=kotlin.Unit origin=null
message: GET_VAR 'val s: kotlin.String [val] declared in <root>.testDestructuring' type=kotlin.String origin=null
FUN name:testRange visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
VAR name:<range> type:kotlin.ranges.IntRange [val]
CALL 'public final fun rangeTo (other: kotlin.Int): kotlin.ranges.IntRange declared in kotlin.Int' type=kotlin.ranges.IntRange origin=null
$this: CONST Int type=kotlin.Int value=1
other: CONST Int type=kotlin.Int value=10
VAR name:<iterator> type:kotlin.collections.IntIterator [val]
CALL 'public open fun iterator (): kotlin.collections.IntIterator declared in kotlin.ranges.IntProgression' type=kotlin.collections.IntIterator origin=null
$this: GET_VAR 'val <range>: kotlin.ranges.IntRange [val] declared in <root>.testRange' type=kotlin.ranges.IntRange origin=null
WHILE label=null origin=FOR_LOOP_INNER_WHILE
condition: CALL 'public abstract fun hasNext (): kotlin.Boolean declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=null
$this: GET_VAR 'val <iterator>: kotlin.collections.IntIterator [val] declared in <root>.testRange' type=kotlin.collections.IntIterator origin=null
body: BLOCK type=kotlin.Unit origin=null
VAR name:i type:kotlin.Int [val]
CALL 'public final fun next (): kotlin.Int declared in kotlin.collections.IntIterator' type=kotlin.Int origin=null
$this: GET_VAR 'val <iterator>: kotlin.collections.IntIterator [val] declared in <root>.testRange' type=kotlin.collections.IntIterator origin=null
+3
View File
@@ -17,3 +17,6 @@ fun testDestructuring(pp: List<Pair<Int, String>>) {
}
}
fun testRange() {
for (i in 1..10);
}
+15
View File
@@ -55,3 +55,18 @@ FILE fqName:<root> fileName:/for.kt
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' type=kotlin.Unit origin=null
message: GET_VAR 'val s: kotlin.String [val] declared in <root>.testDestructuring' type=kotlin.String origin=null
FUN name:testRange visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
BLOCK type=kotlin.Unit origin=FOR_LOOP
VAR FOR_LOOP_ITERATOR name:tmp0_iterator type:kotlin.collections.IntIterator [val]
CALL 'public open fun iterator (): kotlin.collections.IntIterator declared in kotlin.ranges.IntRange' type=kotlin.collections.IntIterator origin=FOR_LOOP_ITERATOR
$this: CALL 'public final fun rangeTo (other: kotlin.Int): kotlin.ranges.IntRange 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 declared in kotlin.collections.IntIterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT
$this: GET_VAR 'val tmp0_iterator: 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 declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT
$this: GET_VAR 'val tmp0_iterator: kotlin.collections.IntIterator [val] declared in <root>.testRange' type=kotlin.collections.IntIterator origin=null