'while' and 'do-while' loop generator fixes.

Generate 'do-while' loop body as IrComposite, because variables declared
in loop body should be visible in loop condition.
Wrap 'do-while' loop in IrBlock so that variables declared in loop body
are not visible outside of the loop.

Generate 'while' and 'do-while' loops as expressions of type Unit.
This commit is contained in:
Dmitry Petrov
2017-03-06 19:02:52 +03:00
parent cb61c358ea
commit d096f1d381
6 changed files with 105 additions and 70 deletions
@@ -7,7 +7,7 @@ FILE /badBreakContinue.kt
BLOCK_BODY
WHILE label=L1 origin=WHILE_LOOP
condition: CONST Boolean type=kotlin.Boolean value='true'
body: BLOCK type=kotlin.Nothing origin=null
body: BLOCK type=kotlin.Unit origin=null
ERROR_EXPR 'Loop not found for break expression: break@ERROR' type=kotlin.Nothing
ERROR_EXPR 'Loop not found for continue expression: continue@ERROR' type=kotlin.Nothing
FUN public fun test3(): kotlin.Unit