mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
cf077ca4a0
commit
ead2883d1c
1 changed files with 23 additions and 26 deletions
|
@ -22,16 +22,14 @@ 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Switch statement in c++.
|
* Switch statement in C++.
|
||||||
*/
|
*/
|
||||||
public class CPPASTSwitchStatement extends ASTNode implements
|
public class CPPASTSwitchStatement extends ASTNode
|
||||||
ICPPASTSwitchStatement, IASTAmbiguityParent {
|
implements ICPPASTSwitchStatement, IASTAmbiguityParent {
|
||||||
|
|
||||||
private IScope scope;
|
private IScope scope;
|
||||||
private IASTExpression controllerExpression;
|
private IASTExpression controllerExpression;
|
||||||
private IASTDeclaration controllerDeclaration;
|
private IASTDeclaration controllerDeclaration;
|
||||||
private IASTStatement body;
|
private IASTStatement body;
|
||||||
|
|
||||||
|
|
||||||
public CPPASTSwitchStatement() {
|
public CPPASTSwitchStatement() {
|
||||||
}
|
}
|
||||||
|
@ -52,10 +50,10 @@ public class CPPASTSwitchStatement extends ASTNode implements
|
||||||
|
|
||||||
public CPPASTSwitchStatement copy(CopyStyle style) {
|
public CPPASTSwitchStatement copy(CopyStyle style) {
|
||||||
CPPASTSwitchStatement copy = new CPPASTSwitchStatement();
|
CPPASTSwitchStatement copy = new CPPASTSwitchStatement();
|
||||||
copy.setControllerDeclaration(controllerDeclaration == null ? null : controllerDeclaration
|
copy.setControllerDeclaration(controllerDeclaration == null ?
|
||||||
.copy(style));
|
null : controllerDeclaration.copy(style));
|
||||||
copy.setControllerExpression(controllerExpression == null ? null : controllerExpression
|
copy.setControllerExpression(controllerExpression == null ?
|
||||||
.copy(style));
|
null : controllerExpression.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) {
|
||||||
|
@ -92,23 +90,23 @@ public class CPPASTSwitchStatement extends ASTNode implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@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( controllerExpression != null ) if( !controllerExpression.accept( action ) ) return false;
|
if (controllerExpression != null && !controllerExpression.accept(action)) return false;
|
||||||
if( controllerDeclaration != null ) if( !controllerDeclaration.accept( action ) ) return false;
|
if (controllerDeclaration != null && !controllerDeclaration.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;
|
||||||
|
@ -143,9 +141,8 @@ public class CPPASTSwitchStatement extends ASTNode implements
|
||||||
}
|
}
|
||||||
|
|
||||||
public IScope getScope() {
|
public IScope getScope() {
|
||||||
if( scope == null )
|
if (scope == null)
|
||||||
scope = new CPPBlockScope( this );
|
scope = new CPPBlockScope(this);
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue