From cbcfeaa1b7710767aeed57bfc88b66ab804f41ff Mon Sep 17 00:00:00 2001 From: svtk Date: Wed, 18 Jan 2012 14:34:28 +0400 Subject: [PATCH] control flow construction: creation of unbound labels in when fixed --- .../jetbrains/jet/lang/cfg/JetControlFlowProcessor.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java index 12fee5b0ec3..3b9acb1366a 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java @@ -750,7 +750,7 @@ public class JetControlFlowProcessor { Label doneLabel = builder.createUnboundLabel(); - Label nextLabel = builder.createUnboundLabel(); + Label nextLabel = null; for (Iterator iterator = expression.getEntries().iterator(); iterator.hasNext(); ) { JetWhenEntry whenEntry = iterator.next(); @@ -779,6 +779,7 @@ public class JetControlFlowProcessor { } if (!isIrrefutable) { + nextLabel = builder.createUnboundLabel(); builder.nondeterministicJump(nextLabel); } @@ -786,8 +787,10 @@ public class JetControlFlowProcessor { value(whenEntry.getExpression(), inCondition); builder.allowDead(); builder.jump(doneLabel); - builder.bindLabel(nextLabel); - nextLabel = builder.createUnboundLabel(); + + if (!isIrrefutable) { + builder.bindLabel(nextLabel); + } } builder.bindLabel(doneLabel); if (!hasElseOrIrrefutableBranch) {