1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2011-04-19 06:59:42 +00:00
parent c57e4131c7
commit 7cd1ba37af

View file

@ -23,7 +23,7 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent; import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/** /**
* For statement in c++ * For statement in C++
*/ */
public class CPPASTForStatement extends ASTNode implements ICPPASTForStatement, IASTAmbiguityParent { public class CPPASTForStatement extends ASTNode implements ICPPASTForStatement, IASTAmbiguityParent {
private IScope scope = null; private IScope scope = null;
@ -34,8 +34,6 @@ public class CPPASTForStatement extends ASTNode implements ICPPASTForStatement,
private IASTExpression iterationExpression; private IASTExpression iterationExpression;
private IASTStatement body; private IASTStatement body;
public CPPASTForStatement() { public CPPASTForStatement() {
} }
@ -64,8 +62,8 @@ public class CPPASTForStatement extends ASTNode implements ICPPASTForStatement,
copy.setInitializerStatement(init == null ? null : init.copy(style)); copy.setInitializerStatement(init == null ? null : init.copy(style));
copy.setConditionDeclaration(condDeclaration == null ? null : condDeclaration.copy(style)); copy.setConditionDeclaration(condDeclaration == null ? null : condDeclaration.copy(style));
copy.setConditionExpression(condition == null ? null : condition.copy(style)); copy.setConditionExpression(condition == null ? null : condition.copy(style));
copy.setIterationExpression(iterationExpression == null ? null : iterationExpression copy.setIterationExpression(iterationExpression == null ?
.copy(style)); null : iterationExpression.copy(style));
copy.setBody(body == null ? null : body.copy(style)); copy.setBody(body == null ? null : body.copy(style));
copy.setOffsetAndLength(this); copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) { if (style == CopyStyle.withLocations) {
@ -115,31 +113,31 @@ public class CPPASTForStatement extends ASTNode implements ICPPASTForStatement,
} }
public IScope getScope() { public IScope getScope() {
if( scope == null ) if (scope == null)
scope = new CPPBlockScope( this ); scope = new CPPBlockScope(this);
return scope; return scope;
} }
@Override @Override
public boolean accept( ASTVisitor action ){ public boolean accept(ASTVisitor action) {
if( action.shouldVisitStatements ){ if (action.shouldVisitStatements) {
switch( action.visit( this ) ){ switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT : return false; case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP : return true; case ASTVisitor.PROCESS_SKIP: return true;
default : break; default: break;
} }
} }
if( init != null ) if( !init.accept( action ) ) return false; if (init != null && !init.accept(action)) return false;
if( condition != null ) if( !condition.accept( action ) ) return false; if (condition != null && !condition.accept(action)) return false;
if( condDeclaration != null ) if( !condDeclaration.accept( action ) ) return false; if (condDeclaration != null && !condDeclaration.accept(action)) return false;
if( iterationExpression != null ) if( !iterationExpression.accept( action ) ) return false; if (iterationExpression != null && !iterationExpression.accept(action)) return false;
if( body != null ) if( !body.accept( action ) ) return false; if (body != null && !body.accept(action)) return false;
if( action.shouldVisitStatements ){ if (action.shouldVisitStatements) {
switch( action.leave( this ) ){ switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT : return false; case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP : return true; case ASTVisitor.PROCESS_SKIP: return true;
default : break; default: break;
} }
} }
return true; return true;