'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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user