Empty loops.

This commit is contained in:
Dmitry Petrov
2016-08-25 14:48:46 +03:00
committed by Dmitry Petrov
parent 179a06672b
commit d45811a5da
8 changed files with 47 additions and 17 deletions
+4
View File
@@ -1,3 +1,7 @@
fun testEmpty(ss: List<String>) {
for (s in ss);
}
fun testIterable(ss: List<String>) {
for (s in ss) {
println(s)
+13
View File
@@ -1,4 +1,17 @@
FILE /for.kt
FUN public fun testEmpty(/*0*/ ss: kotlin.collections.List<kotlin.String>): kotlin.Unit
BLOCK_BODY
BLOCK type=kotlin.Unit operator=FOR_LOOP
VAR val tmp0_iterator: kotlin.collections.Iterator<kotlin.String>
CALL .iterator type=kotlin.collections.Iterator<kotlin.String> operator=FOR_LOOP_ITERATOR
$this: GET_VAR ss type=kotlin.collections.List<kotlin.String> operator=null
WHILE label=null operator=FOR_LOOP_INNER_WHILE
condition: CALL .hasNext type=kotlin.Boolean operator=FOR_LOOP_HAS_NEXT
$this: GET_VAR tmp0_iterator type=kotlin.collections.Iterator<kotlin.String> operator=null
body: BLOCK type=kotlin.Unit operator=FOR_LOOP_INNER_WHILE
VAR val s: kotlin.String
CALL .next type=kotlin.String operator=FOR_LOOP_NEXT
$this: GET_VAR tmp0_iterator type=kotlin.collections.Iterator<kotlin.String> operator=null
FUN public fun testIterable(/*0*/ ss: kotlin.collections.List<kotlin.String>): kotlin.Unit
BLOCK_BODY
BLOCK type=kotlin.Unit operator=FOR_LOOP
+2
View File
@@ -1,7 +1,9 @@
fun test() {
var x = 0
while (x < 0);
while (x < 5) x++
while (x < 10) { x++ }
do while (x < 0)
do x++ while (x < 15)
do { x ++ } while (x < 20)
}
+10
View File
@@ -3,6 +3,11 @@ FILE /whileDoWhile.kt
BLOCK_BODY
VAR var x: kotlin.Int
CONST Int type=kotlin.Int value='0'
WHILE label=null operator=WHILE_LOOP
condition: CALL .LT0 type=kotlin.Boolean operator=LT
arg0: CALL .compareTo type=kotlin.Int operator=LT
$this: GET_VAR x type=kotlin.Int operator=null
other: CONST Int type=kotlin.Int value='0'
WHILE label=null operator=WHILE_LOOP
condition: CALL .LT0 type=kotlin.Boolean operator=LT
arg0: CALL .compareTo type=kotlin.Int operator=LT
@@ -28,6 +33,11 @@ FILE /whileDoWhile.kt
CALL .inc type=kotlin.Int operator=POSTFIX_INCR
$this: GET_VAR tmp1 type=kotlin.Int operator=null
GET_VAR tmp1 type=kotlin.Int operator=null
DO_WHILE label=null operator=DO_WHILE_LOOP
condition: CALL .LT0 type=kotlin.Boolean operator=LT
arg0: CALL .compareTo type=kotlin.Int operator=LT
$this: GET_VAR x type=kotlin.Int operator=null
other: CONST Int type=kotlin.Int value='0'
DO_WHILE label=null operator=DO_WHILE_LOOP
body: BLOCK type=kotlin.Int operator=POSTFIX_INCR
VAR val tmp2: kotlin.Int