diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index c24f937d23f..7b212c870fd 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -1366,44 +1366,44 @@ public class ExpressionCodegen extends KtVisitor impleme ) { assert expression instanceof KtContinueExpression || expression instanceof KtBreakExpression; - if (!blockStackElements.isEmpty()) { - BlockStackElement stackElement = blockStackElements.peek(); - - if (stackElement instanceof FinallyBlockStackElement) { - FinallyBlockStackElement finallyBlockStackElement = (FinallyBlockStackElement) stackElement; - //noinspection ConstantConditions - genFinallyBlockOrGoto(finallyBlockStackElement, null, afterBreakContinueLabel); - } - else if (stackElement instanceof LoopBlockStackElement) { - LoopBlockStackElement loopBlockStackElement = (LoopBlockStackElement) stackElement; - KtSimpleNameExpression labelElement = expression.getTargetLabel(); - //noinspection ConstantConditions - if (labelElement == null || - loopBlockStackElement.targetLabel != null && - labelElement.getReferencedName().equals(loopBlockStackElement.targetLabel.getReferencedName())) { - final Label label = isBreak ? loopBlockStackElement.breakLabel : loopBlockStackElement.continueLabel; - return StackValue.operation(Type.VOID_TYPE, new Function1() { - @Override - public Unit invoke(InstructionAdapter adapter) { - PseudoInsnsKt.fixStackAndJump(v, label); - v.mark(afterBreakContinueLabel); - return Unit.INSTANCE; - } - } - ); - } - } - else { - throw new UnsupportedOperationException("Wrong BlockStackElement in processing stack"); - } - - blockStackElements.pop(); - StackValue result = generateBreakOrContinueExpression(expression, isBreak, afterBreakContinueLabel); - blockStackElements.push(stackElement); - return result; + if (blockStackElements.isEmpty()) { + throw new UnsupportedOperationException("Target label for break/continue not found"); } - throw new UnsupportedOperationException("Target label for break/continue not found"); + BlockStackElement stackElement = blockStackElements.peek(); + + if (stackElement instanceof FinallyBlockStackElement) { + FinallyBlockStackElement finallyBlockStackElement = (FinallyBlockStackElement) stackElement; + //noinspection ConstantConditions + genFinallyBlockOrGoto(finallyBlockStackElement, null, afterBreakContinueLabel); + } + else if (stackElement instanceof LoopBlockStackElement) { + LoopBlockStackElement loopBlockStackElement = (LoopBlockStackElement) stackElement; + KtSimpleNameExpression labelElement = expression.getTargetLabel(); + //noinspection ConstantConditions + if (labelElement == null || + loopBlockStackElement.targetLabel != null && + labelElement.getReferencedName().equals(loopBlockStackElement.targetLabel.getReferencedName())) { + final Label label = isBreak ? loopBlockStackElement.breakLabel : loopBlockStackElement.continueLabel; + return StackValue.operation(Type.VOID_TYPE, new Function1() { + @Override + public Unit invoke(InstructionAdapter adapter) { + PseudoInsnsKt.fixStackAndJump(v, label); + v.mark(afterBreakContinueLabel); + return Unit.INSTANCE; + } + } + ); + } + } + else { + throw new UnsupportedOperationException("Wrong BlockStackElement in processing stack"); + } + + blockStackElements.pop(); + StackValue result = generateBreakOrContinueExpression(expression, isBreak, afterBreakContinueLabel); + blockStackElements.push(stackElement); + return result; } private StackValue generateSingleBranchIf(