public class ContinueStatement extends BranchStatement {
- public ContinueStatement(char[] l, int s, int e) {
+ public ContinueStatement(Expression expr, int s, int e) {
- super(l, s, e);
+ super(expr, s, e);
}
public FlowInfo analyseCode(
// to each of the traversed try statements, so that execution will terminate properly.
// lookup the label, this should answer the returnContext
- FlowContext targetContext = (label == null)
- ? flowContext.getTargetContextForDefaultContinue()
- : flowContext.getTargetContextForContinueLabel(label);
+// FlowContext targetContext = (expression == null)
+// ? flowContext.getTargetContextForDefaultContinue()
+// : flowContext.getTargetContextForContinueLabel(label);
- if (targetContext == null) {
- if (label == null) {
- currentScope.problemReporter().invalidContinue(this);
- } else {
- currentScope.problemReporter().undefinedLabel(this);
- }
- return flowInfo; // pretend it did not continue since no actual target
- }
+// if (targetContext == null) {
+// if (expression == null) {
+// currentScope.problemReporter().invalidContinue(this);
+// } else {
+// currentScope.problemReporter().undefinedLabel(this);
+// }
+// return flowInfo; // pretend it did not continue since no actual target
+// }
- if (targetContext == FlowContext.NotContinuableContext) {
- currentScope.problemReporter().invalidContinue(this);
- return flowInfo; // pretend it did not continue since no actual target
- }
- targetLabel = targetContext.continueLabel();
- FlowContext traversedContext = flowContext;
- int subIndex = 0, maxSub = 5;
- subroutines = new ASTNode[maxSub];
-
- do {
- ASTNode sub;
- if ((sub = traversedContext.subRoutine()) != null) {
- if (subIndex == maxSub) {
- System.arraycopy(subroutines, 0, (subroutines = new ASTNode[maxSub*=2]), 0, subIndex); // grow
- }
- subroutines[subIndex++] = sub;
- if (sub.cannotReturn()) {
- break;
- }
- }
- traversedContext.recordReturnFrom(flowInfo.unconditionalInits());
-
- ASTNode node;
- if ((node = traversedContext.associatedNode) instanceof TryStatement) {
- TryStatement tryStatement = (TryStatement) node;
- flowInfo.addInitializationsFrom(tryStatement.subRoutineInits); // collect inits
- } else if (traversedContext == targetContext) {
- // only record continue info once accumulated through subroutines, and only against target context
- targetContext.recordContinueFrom(flowInfo);
- break;
- }
- } while ((traversedContext = traversedContext.parent) != null);
-
- // resize subroutines
- if (subIndex != maxSub) {
- System.arraycopy(subroutines, 0, (subroutines = new ASTNode[subIndex]), 0, subIndex);
- }
+// if (targetContext == FlowContext.NotContinuableContext) {
+// currentScope.problemReporter().invalidContinue(this);
+// return flowInfo; // pretend it did not continue since no actual target
+// }
+// targetLabel = targetContext.continueLabel();
+// FlowContext traversedContext = flowContext;
+// int subIndex = 0, maxSub = 5;
+// subroutines = new ASTNode[maxSub];
+//
+// do {
+// ASTNode sub;
+// if ((sub = traversedContext.subRoutine()) != null) {
+// if (subIndex == maxSub) {
+// System.arraycopy(subroutines, 0, (subroutines = new ASTNode[maxSub*=2]), 0, subIndex); // grow
+// }
+// subroutines[subIndex++] = sub;
+// if (sub.cannotReturn()) {
+// break;
+// }
+// }
+// traversedContext.recordReturnFrom(flowInfo.unconditionalInits());
+//
+// ASTNode node;
+// if ((node = traversedContext.associatedNode) instanceof TryStatement) {
+// TryStatement tryStatement = (TryStatement) node;
+// flowInfo.addInitializationsFrom(tryStatement.subRoutineInits); // collect inits
+// } else if (traversedContext == targetContext) {
+// // only record continue info once accumulated through subroutines, and only against target context
+// targetContext.recordContinueFrom(flowInfo);
+// break;
+// }
+// } while ((traversedContext = traversedContext.parent) != null);
+//
+// // resize subroutines
+// if (subIndex != maxSub) {
+// System.arraycopy(subroutines, 0, (subroutines = new ASTNode[subIndex]), 0, subIndex);
+// }
return FlowInfo.DEAD_END;
}
public StringBuffer printStatement(int tab, StringBuffer output) {
printIndent(tab, output).append("continue "); //$NON-NLS-1$
- if (label != null) output.append(label);
+ if (expression != null) output.append(expression);
return output.append(';');
}
public String toString(int tab) {
String s = tabString(tab);
s += "continue "; //$NON-NLS-1$
- if (label != null)
- s += new String(label);
+ if (expression != null)
+ s += expression.toString();
return s;
}