Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2012 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: IBM Corporation - initial API and implementation Stephan Herrmann - Contribution for bug 345305 - [compiler][null] Compiler misidentifies a case of "variable can only be null" /
 
 package org.eclipse.jdt.internal.compiler.ast;
 
 
 public class ContinueStatement extends BranchStatement {
 
 public ContinueStatement(char[] labelint sourceStartint sourceEnd) {
 	super(labelsourceStartsourceEnd);
 }
 
 public FlowInfo analyseCode(BlockScope currentScopeFlowContext flowContextFlowInfo flowInfo) {
 
 	// here requires to generate a sequence of finally blocks invocations depending corresponding
 	// to each of the traversed try statements, so that execution will terminate properly.
 
 	// lookup the label, this should answer the returnContext
 	FlowContext targetContext = (this. == null)
 			: flowContext.getTargetContextForContinueLabel(this.);
 
 	if (targetContext == null) {
 		if (this. == null) {
 			currentScope.problemReporter().invalidContinue(this);
 		} else {
 			currentScope.problemReporter().undefinedLabel(this);
 		}
 		return flowInfo// pretend it did not continue since no actual target
 	}
 
 	targetContext.recordAbruptExit();
 
 	if (targetContext == .) {
 		currentScope.problemReporter().invalidContinue(this);
 		return flowInfo// pretend it did not continue since no actual target
 	}
 	this. =
 		currentScope.methodScope().recordInitializationStates(flowInfo);
 
 	this. = targetContext.continueLabel();
 	FlowContext traversedContext = flowContext;
 	int subCount = 0;
 	this. = new SubRoutineStatement[5];
 
 	do {
 		if ((sub = traversedContext.subroutine()) != null) {
 			if (subCount == this..length) {
 				System.arraycopy(this., 0, this. = new SubRoutineStatement[subCount*2], 0, subCount); // grow
 			}
 			this.[subCount++] = sub;
 			if (sub.isSubRoutineEscaping()) {
 				break;
 			}
 		}
 		traversedContext.recordReturnFrom(flowInfo.unconditionalInits());
 
 		if (traversedContext instanceof InsideSubRoutineFlowContext) {
 			ASTNode node = traversedContext.associatedNode;
 			if (node instanceof TryStatement) {
 				TryStatement tryStatement = (TryStatementnode;
 				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(flowContextflowInfo);
 			break;
 		}
 	} while ((traversedContext = traversedContext.getLocalParent()) != null);
 
 	// resize subroutines
 	if (subCount != this..length) {
 		System.arraycopy(this., 0, this. = new SubRoutineStatement[subCount], 0, subCount);
 	}
 	return .;
 }
 
 public StringBuffer printStatement(int tabStringBuffer output) {
 	printIndent(taboutput).append("continue "); //$NON-NLS-1$
 	if (this. != nulloutput.append(this.);
 	return output.append(';');
 }
 
 public void traverse(ASTVisitor visitorBlockScope blockScope) {
 	visitor.visit(thisblockScope);
 	visitor.endVisit(thisblockScope);
New to GrepCode? Check out our FAQ X