backend/codegen: improve break and continue support
Do not rely on loop label.
This commit is contained in:
committed by
SvyatoslavScherbina
parent
f6e8735a08
commit
494d825da5
+2
-2
@@ -320,14 +320,14 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid
|
||||
val loopCheck = codegen.basicBlock()
|
||||
|
||||
override fun genBreak(destination: IrBreak) {
|
||||
if (destination.label == null || destination.label == loop.label)
|
||||
if (destination.loop == loop)
|
||||
codegen.br(loopExit)
|
||||
else
|
||||
super.genBreak(destination)
|
||||
}
|
||||
|
||||
override fun genContinue(destination: IrContinue) {
|
||||
if (destination.label == null || destination.label == loop.label)
|
||||
if (destination.loop == loop)
|
||||
codegen.br(loopCheck)
|
||||
else
|
||||
super.genContinue(destination)
|
||||
|
||||
Reference in New Issue
Block a user