1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2012-04-12 16:40:08 -07:00
parent df5940c5fa
commit f02e178d52
45 changed files with 603 additions and 580 deletions

View file

@ -17,9 +17,6 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTStatement extends IASTNode { public interface IASTStatement extends IASTNode {
/**
* Constant.
*/
public static final IASTStatement[] EMPTY_STATEMENT_ARRAY = {}; public static final IASTStatement[] EMPTY_STATEMENT_ARRAY = {};
/** /**

View file

@ -16,14 +16,13 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNameOwner; import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
/** /**
* This interface represents a namespace alias in C++. e.g. namespace ABC { int * This interface represents a namespace alias in C++,
* x; } namspace DEF = ABC; * e.g. namespace ABC { int* x; } namespace DEF = ABC;
* *
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTNamespaceAlias extends IASTDeclaration, IASTNameOwner { public interface ICPPASTNamespaceAlias extends IASTDeclaration, IASTNameOwner {
/** /**
* <code>ALIAS_NAME</code> represents the new namespace name being * <code>ALIAS_NAME</code> represents the new namespace name being
* introduced. * introduced.
@ -68,7 +67,6 @@ public interface ICPPASTNamespaceAlias extends IASTDeclaration, IASTNameOwner {
*/ */
public void setMappingName(IASTName qualifiedName); public void setMappingName(IASTName qualifiedName);
/** /**
* @since 5.1 * @since 5.1
*/ */
@ -80,5 +78,4 @@ public interface ICPPASTNamespaceAlias extends IASTDeclaration, IASTNameOwner {
*/ */
@Override @Override
public ICPPASTNamespaceAlias copy(CopyStyle style); public ICPPASTNamespaceAlias copy(CopyStyle style);
} }

View file

@ -0,0 +1,43 @@
/*******************************************************************************
* Copyright (c) 2012 Google, Inc 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:
* Sergey Prigogin (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser;
import org.eclipse.cdt.core.dom.ast.IASTToken;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.internal.core.parser.scanner.Token;
/**
* Base class for C and C++ attributes.
*/
public class ASTToken extends ASTNode implements IASTToken {
private final IToken token;
public ASTToken(IToken token) {
this.token = token;
}
@Override
public ASTToken copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public ASTToken copy(CopyStyle style) {
Token tokenCopy = ((Token) token).clone();
tokenCopy.setNext(null);
return super.copy(new ASTToken(tokenCopy), style);
}
@Override
public IToken getToken() {
return token;
}
}

View file

@ -0,0 +1,59 @@
/*******************************************************************************
* Copyright (c) 2012 Google, Inc 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:
* Sergey Prigogin (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser;
import org.eclipse.cdt.core.dom.ast.IASTToken;
import org.eclipse.cdt.core.dom.ast.IASTTokenList;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
/**
* Represents a sequence of code tokens.
*/
public class ASTTokenList extends ASTNode implements IASTTokenList {
private IASTToken[] tokens = IASTToken.EMPTY_TOKEN_ARRAY;
public ASTTokenList() {
}
@Override
public ASTTokenList copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public ASTTokenList copy(CopyStyle style) {
ASTTokenList copy = super.copy(new ASTTokenList(), style);
for (IASTToken token : tokens) {
if (token == null)
break;
copy.addToken(token.copy(style));
}
return copy;
}
@Override
public IASTToken[] getTokens() {
tokens = ArrayUtil.trim(tokens);
return tokens;
}
@Override
public void addToken(IASTToken token) {
tokens = ArrayUtil.append(tokens, token);
}
@Override
public IToken getToken() {
IASTToken[] tok = getTokens();
return tok != null && tok.length == 1 ? tok[0].getToken() : null;
}
}

View file

@ -12,9 +12,7 @@ package org.eclipse.cdt.internal.core.dom.parser;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
public interface IASTAmbiguityParent { public interface IASTAmbiguityParent {
public void replace(IASTNode child, IASTNode other); public void replace(IASTNode child, IASTNode other);
} }

View file

@ -14,9 +14,9 @@ import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.IASTStatement; import org.eclipse.cdt.core.dom.ast.IASTStatement;
public interface IASTAmbiguousStatement extends IASTStatement { public interface IASTAmbiguousStatement extends IASTStatement {
public static final ASTNodeProperty STATEMENT = new ASTNodeProperty("IASTAmbiguousStatement.STATEMENT - Ambiguous statement."); //$NON-NLS-1$ public static final ASTNodeProperty STATEMENT = new ASTNodeProperty("IASTAmbiguousStatement.STATEMENT - Ambiguous statement."); //$NON-NLS-1$
public void addStatement( IASTStatement s );
public IASTStatement [] getStatements();
public void addStatement(IASTStatement s);
public IASTStatement[] getStatements();
} }

View file

@ -31,7 +31,6 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTInternalScope;
* @since 5.0.1 * @since 5.0.1
*/ */
public class CASTAmbiguousSimpleDeclaration extends ASTAmbiguousNode implements IASTAmbiguousSimpleDeclaration { public class CASTAmbiguousSimpleDeclaration extends ASTAmbiguousNode implements IASTAmbiguousSimpleDeclaration {
private IASTSimpleDeclaration fSimpleDecl; private IASTSimpleDeclaration fSimpleDecl;
private IASTDeclSpecifier fAltDeclSpec; private IASTDeclSpecifier fAltDeclSpec;
private IASTDeclarator fAltDtor; private IASTDeclarator fAltDtor;

View file

@ -24,7 +24,6 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTInternalScope;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPASTInternalScope; import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPASTInternalScope;
public class CASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAmbiguousStatement { public class CASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAmbiguousStatement {
private IASTStatement[] stmts = new IASTStatement[2]; private IASTStatement[] stmts = new IASTStatement[2];
private int stmtsPos= -1; private int stmtsPos= -1;
private IScope fScope; private IScope fScope;
@ -90,7 +89,6 @@ public class CASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAmbi
return getStatements(); return getStatements();
} }
@Override @Override
public IASTStatement copy() { public IASTStatement copy() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
@ -100,5 +98,4 @@ public class CASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAmbi
public IASTStatement copy(CopyStyle style) { public IASTStatement copy(CopyStyle style) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
} }

View file

@ -19,7 +19,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
* @author jcamelon * @author jcamelon
*/ */
public class CASTBreakStatement extends ASTNode implements IASTBreakStatement { public class CASTBreakStatement extends ASTNode implements IASTBreakStatement {
@Override @Override
public boolean accept(ASTVisitor action) { public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) { if (action.shouldVisitStatements) {

View file

@ -22,10 +22,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* @author jcamelon * @author jcamelon
*/ */
public class CASTCaseStatement extends ASTNode implements IASTCaseStatement, IASTAmbiguityParent { public class CASTCaseStatement extends ASTNode implements IASTCaseStatement, IASTAmbiguityParent {
private IASTExpression expression; private IASTExpression expression;
public CASTCaseStatement() { public CASTCaseStatement() {
} }
@ -86,8 +84,7 @@ public class CASTCaseStatement extends ASTNode implements IASTCaseStatement, IAS
@Override @Override
public void replace(IASTNode child, IASTNode other) { public void replace(IASTNode child, IASTNode other) {
if( child == expression ) if (child == expression) {
{
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent()); other.setParent(child.getParent());
expression = (IASTExpression) other; expression = (IASTExpression) other;

View file

@ -19,7 +19,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
* @author jcamelon * @author jcamelon
*/ */
public class CASTDefaultStatement extends ASTNode implements IASTDefaultStatement { public class CASTDefaultStatement extends ASTNode implements IASTDefaultStatement {
@Override @Override
public boolean accept(ASTVisitor action) { public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) { if (action.shouldVisitStatements) {

View file

@ -23,11 +23,9 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* @author jcamelon * @author jcamelon
*/ */
public class CASTDoStatement extends ASTNode implements IASTDoStatement, IASTAmbiguityParent { public class CASTDoStatement extends ASTNode implements IASTDoStatement, IASTAmbiguityParent {
private IASTStatement body; private IASTStatement body;
private IASTExpression condition; private IASTExpression condition;
public CASTDoStatement() { public CASTDoStatement() {
} }
@ -68,13 +66,11 @@ public class CASTDoStatement extends ASTNode implements IASTDoStatement, IASTAmb
} }
} }
@Override @Override
public IASTExpression getCondition() { public IASTExpression getCondition() {
return condition; return condition;
} }
@Override @Override
public void setCondition(IASTExpression condition) { public void setCondition(IASTExpression condition) {
assertNotFrozen(); assertNotFrozen();
@ -94,8 +90,10 @@ public class CASTDoStatement extends ASTNode implements IASTDoStatement, IASTAmb
default: break; default: break;
} }
} }
if( body != null ) if( !body.accept( action ) ) return false;
if( condition != null ) if( !condition.accept( action ) ) return false; if (body != null && !body.accept(action)) return false;
if (condition != null && !condition.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;
@ -108,14 +106,12 @@ public class CASTDoStatement extends ASTNode implements IASTDoStatement, IASTAmb
@Override @Override
public void replace(IASTNode child, IASTNode other) { public void replace(IASTNode child, IASTNode other) {
if( body == child ) if (body == child) {
{
other.setPropertyInParent(body.getPropertyInParent()); other.setPropertyInParent(body.getPropertyInParent());
other.setParent(body.getParent()); other.setParent(body.getParent());
body = (IASTStatement) other; body = (IASTStatement) other;
} }
if( child == condition ) if (child == condition) {
{
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent()); other.setParent(child.getParent());
condition = (IASTExpression) other; condition = (IASTExpression) other;

View file

@ -23,10 +23,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
*/ */
public class CASTExpressionStatement extends ASTNode implements public class CASTExpressionStatement extends ASTNode implements
IASTExpressionStatement, IASTAmbiguityParent { IASTExpressionStatement, IASTAmbiguityParent {
private IASTExpression expression; private IASTExpression expression;
public CASTExpressionStatement() { public CASTExpressionStatement() {
} }
@ -69,26 +67,19 @@ public class CASTExpressionStatement extends ASTNode implements
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: case ASTVisitor.PROCESS_ABORT: return false;
return false; case ASTVisitor.PROCESS_SKIP: return true;
case ASTVisitor.PROCESS_SKIP: default: break;
return true;
default:
break;
} }
} }
if (expression != null)
if (!expression.accept(action)) if (expression != null && !expression.accept(action)) return false;
return false;
if (action.shouldVisitStatements) { if (action.shouldVisitStatements) {
switch (action.leave(this)) { switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: case ASTVisitor.PROCESS_ABORT: return false;
return false; case ASTVisitor.PROCESS_SKIP: return true;
case ASTVisitor.PROCESS_SKIP: default: break;
return true;
default:
break;
} }
} }
@ -103,5 +94,4 @@ public class CASTExpressionStatement extends ASTNode implements
expression = (IASTExpression) other; expression = (IASTExpression) other;
} }
} }
} }

View file

@ -25,12 +25,11 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* @author jcamelon * @author jcamelon
*/ */
public class CASTForStatement extends ASTNode implements IASTForStatement, IASTAmbiguityParent { public class CASTForStatement extends ASTNode implements IASTForStatement, IASTAmbiguityParent {
private IScope scope = null; private IScope scope;
private IASTExpression condition; private IASTExpression condition;
private IASTExpression iterationExpression; private IASTExpression iterationExpression;
private IASTStatement body, init; private IASTStatement body;
private IASTStatement init;
public CASTForStatement() { public CASTForStatement() {
} }
@ -61,8 +60,8 @@ public class CASTForStatement extends ASTNode implements IASTForStatement, IASTA
protected void copyForStatement(CASTForStatement copy, CopyStyle style) { protected void copyForStatement(CASTForStatement copy, CopyStyle style) {
copy.setInitializerStatement(init == null ? null : init.copy(style)); copy.setInitializerStatement(init == null ? null : init.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);
} }
@ -142,10 +141,10 @@ public class CASTForStatement extends ASTNode implements IASTForStatement, IASTA
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( 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)) {
@ -154,36 +153,30 @@ public class CASTForStatement extends ASTNode implements IASTForStatement, IASTA
default: break; default: break;
} }
} }
return true; return true;
} }
@Override @Override
public void replace(IASTNode child, IASTNode other) { public void replace(IASTNode child, IASTNode other) {
if( body == child ) if (body == child) {
{
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent()); other.setParent(child.getParent());
body = (IASTStatement) other; body = (IASTStatement) other;
} }
if( child == init ) if (child == init) {
{
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent()); other.setParent(child.getParent());
init = (IASTStatement) other; init = (IASTStatement) other;
} }
if( child == iterationExpression) if (child == iterationExpression) {
{
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent()); other.setParent(child.getParent());
iterationExpression = (IASTExpression) other; iterationExpression = (IASTExpression) other;
} }
if( child == condition) if (child == condition) {
{
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent()); other.setParent(child.getParent());
condition = (IASTExpression) other; condition = (IASTExpression) other;
} }
} }
} }

View file

@ -20,7 +20,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
* @author jcamelon * @author jcamelon
*/ */
public class CASTGotoStatement extends ASTNode implements IASTGotoStatement { public class CASTGotoStatement extends ASTNode implements IASTGotoStatement {
private IASTName name; private IASTName name;
public CASTGotoStatement() { public CASTGotoStatement() {
@ -69,7 +68,8 @@ public class CASTGotoStatement extends ASTNode implements IASTGotoStatement {
default: break; default: break;
} }
} }
if( name != null ) if( !name.accept( action ) ) return false;
if (name != null && !name.accept(action)) return false;
if (action.shouldVisitStatements) { if (action.shouldVisitStatements) {
switch (action.leave(this)) { switch (action.leave(this)) {

View file

@ -24,13 +24,10 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* If statements for C. * If statements for C.
*/ */
public class CASTIfStatement extends ASTNode implements IASTIfStatement, IASTAmbiguityParent { public class CASTIfStatement extends ASTNode implements IASTIfStatement, IASTAmbiguityParent {
private IASTExpression condition; private IASTExpression condition;
private IASTStatement thenClause; private IASTStatement thenClause;
private IASTStatement elseClause; private IASTStatement elseClause;
public CASTIfStatement() { public CASTIfStatement() {
} }
@ -39,7 +36,6 @@ public class CASTIfStatement extends ASTNode implements IASTIfStatement, IASTAmb
setThenClause(thenClause); setThenClause(thenClause);
} }
public CASTIfStatement(IASTExpression condition, IASTStatement thenClause, IASTStatement elseClause) { public CASTIfStatement(IASTExpression condition, IASTStatement thenClause, IASTStatement elseClause) {
this(condition, thenClause); this(condition, thenClause);
setElseClause(elseClause); setElseClause(elseClause);
@ -165,20 +161,17 @@ public class CASTIfStatement extends ASTNode implements IASTIfStatement, IASTAmb
@Override @Override
public void replace(IASTNode child, IASTNode other) { public void replace(IASTNode child, IASTNode other) {
if( thenClause == child ) if (thenClause == child) {
{
other.setParent(child.getParent()); other.setParent(child.getParent());
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
thenClause = (IASTStatement) other; thenClause = (IASTStatement) other;
} }
if( elseClause == child ) if (elseClause == child) {
{
other.setParent(child.getParent()); other.setParent(child.getParent());
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
elseClause = (IASTStatement) other; elseClause = (IASTStatement) other;
} }
if( child == condition ) if (child == condition) {
{
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent()); other.setParent(child.getParent());
condition = (IASTExpression) other; condition = (IASTExpression) other;

View file

@ -19,7 +19,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
* @author jcamelon * @author jcamelon
*/ */
public class CASTNullStatement extends ASTNode implements IASTNullStatement { public class CASTNullStatement extends ASTNode implements IASTNullStatement {
@Override @Override
public boolean accept(ASTVisitor action) { public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) { if (action.shouldVisitStatements) {
@ -29,6 +28,7 @@ public class CASTNullStatement extends ASTNode implements IASTNullStatement {
default: break; default: break;
} }
} }
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;

View file

@ -19,8 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTProblemDeclaration;
/** /**
* @author jcamelon * @author jcamelon
*/ */
public class CASTProblemDeclaration extends CASTProblemOwner implements public class CASTProblemDeclaration extends CASTProblemOwner implements IASTProblemDeclaration {
IASTProblemDeclaration {
public CASTProblemDeclaration() { public CASTProblemDeclaration() {
super(); super();
@ -54,7 +53,9 @@ public class CASTProblemDeclaration extends CASTProblemOwner implements
default: break; default: break;
} }
} }
super.accept(action); // visits the problem super.accept(action); // visits the problem
if (action.shouldVisitDeclarations) { if (action.shouldVisitDeclarations) {
switch (action.leave(this)) { switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false; case ASTVisitor.PROCESS_ABORT: return false;

View file

@ -53,7 +53,9 @@ public class CASTProblemExpression extends CASTProblemOwner implements IASTProbl
default: break; default: break;
} }
} }
super.accept(action); // visits the problem super.accept(action); // visits the problem
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {
switch (action.leave(this)) { switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false; case ASTVisitor.PROCESS_ABORT: return false;

View file

@ -20,7 +20,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
* @author jcamelon * @author jcamelon
*/ */
abstract class CASTProblemOwner extends ASTNode implements IASTProblemHolder { abstract class CASTProblemOwner extends ASTNode implements IASTProblemHolder {
private IASTProblem problem; private IASTProblem problem;
public CASTProblemOwner() { public CASTProblemOwner() {

View file

@ -52,7 +52,9 @@ public class CASTProblemStatement extends CASTProblemOwner implements IASTProble
default: break; default: break;
} }
} }
super.accept(action); // visits the problem super.accept(action); // visits the problem
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;

View file

@ -22,9 +22,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/** /**
* @author jcamelon * @author jcamelon
*/ */
public class CASTSwitchStatement extends ASTNode implements public class CASTSwitchStatement extends ASTNode
IASTSwitchStatement, IASTAmbiguityParent { implements IASTSwitchStatement, IASTAmbiguityParent {
private IASTExpression controller; private IASTExpression controller;
private IASTStatement body; private IASTStatement body;
@ -92,8 +91,9 @@ public class CASTSwitchStatement extends ASTNode implements
default: break; default: break;
} }
} }
if( controller != null ) if( !controller.accept( action ) ) return false;
if( body != null ) if( !body.accept( action ) ) return false; if (controller != null && !controller.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)) {
@ -107,14 +107,12 @@ public class CASTSwitchStatement extends ASTNode implements
@Override @Override
public void replace(IASTNode child, IASTNode other) { public void replace(IASTNode child, IASTNode other) {
if( body == child ) if (body == child) {
{
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent()); other.setParent(child.getParent());
body = (IASTStatement) other; body = (IASTStatement) other;
} }
if( child == controller ) if (child == controller) {
{
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent()); other.setParent(child.getParent());
controller = (IASTExpression) other; controller = (IASTExpression) other;

View file

@ -33,7 +33,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
* }; * };
*/ */
public class CPPASTAmbiguousSimpleDeclaration extends ASTAmbiguousNode implements IASTAmbiguousSimpleDeclaration { public class CPPASTAmbiguousSimpleDeclaration extends ASTAmbiguousNode implements IASTAmbiguousSimpleDeclaration {
private IASTSimpleDeclaration fSimpleDecl; private IASTSimpleDeclaration fSimpleDecl;
private IASTDeclSpecifier fAltDeclSpec; private IASTDeclSpecifier fAltDeclSpec;
private IASTDeclarator fAltDtor; private IASTDeclarator fAltDtor;
@ -98,7 +97,6 @@ public class CPPASTAmbiguousSimpleDeclaration extends ASTAmbiguousNode implement
IASTDeclarator dtor= fSimpleDecl.getDeclarators()[0]; IASTDeclarator dtor= fSimpleDecl.getDeclarators()[0];
dtor.accept(resolver); dtor.accept(resolver);
// find nested names // find nested names
final NameCollector nameCollector= new NameCollector(); final NameCollector nameCollector= new NameCollector();
dtor.accept(nameCollector); dtor.accept(nameCollector);

View file

@ -23,9 +23,7 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousStatement;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
public class CPPASTAmbiguousStatement extends ASTAmbiguousNode implements public class CPPASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAmbiguousStatement {
IASTAmbiguousStatement {
private IASTStatement[] stmts = new IASTStatement[2]; private IASTStatement[] stmts = new IASTStatement[2];
private int stmtsPos= -1; private int stmtsPos= -1;
private IScope fScope; private IScope fScope;

View file

@ -21,7 +21,6 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* @author jcamelon * @author jcamelon
*/ */
public class CPPASTCaseStatement extends ASTNode implements IASTCaseStatement, IASTAmbiguityParent { public class CPPASTCaseStatement extends ASTNode implements IASTCaseStatement, IASTAmbiguityParent {
private IASTExpression expression; private IASTExpression expression;
public CPPASTCaseStatement() { public CPPASTCaseStatement() {
@ -38,8 +37,8 @@ public class CPPASTCaseStatement extends ASTNode implements IASTCaseStatement, I
@Override @Override
public CPPASTCaseStatement copy(CopyStyle style) { public CPPASTCaseStatement copy(CopyStyle style) {
CPPASTCaseStatement copy = new CPPASTCaseStatement(expression == null ? null CPPASTCaseStatement copy =
: expression.copy(style)); new CPPASTCaseStatement(expression == null ? null : expression.copy(style));
copy.setOffsetAndLength(this); copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) { if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this); copy.setCopyLocation(this);
@ -71,7 +70,8 @@ public class CPPASTCaseStatement extends ASTNode implements IASTCaseStatement, I
default : break; default : break;
} }
} }
if( expression != null ) if( !expression.accept( action ) ) return false;
if (expression != null && !expression.accept(action)) return false;
if (action.shouldVisitStatements) { if (action.shouldVisitStatements) {
switch(action.leave(this)) { switch(action.leave(this)) {
@ -85,8 +85,7 @@ public class CPPASTCaseStatement extends ASTNode implements IASTCaseStatement, I
@Override @Override
public void replace(IASTNode child, IASTNode other) { public void replace(IASTNode child, IASTNode other) {
if( child == expression ) if (child == expression) {
{
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent()); other.setParent(child.getParent());
expression = (IASTExpression) other; expression = (IASTExpression) other;

View file

@ -22,11 +22,9 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* @author jcamelon * @author jcamelon
*/ */
public class CPPASTDoStatement extends ASTNode implements IASTDoStatement, IASTAmbiguityParent { public class CPPASTDoStatement extends ASTNode implements IASTDoStatement, IASTAmbiguityParent {
private IASTStatement body; private IASTStatement body;
private IASTExpression condition; private IASTExpression condition;
public CPPASTDoStatement() { public CPPASTDoStatement() {
} }
@ -91,8 +89,10 @@ public class CPPASTDoStatement extends ASTNode implements IASTDoStatement, IASTA
default: break; default: break;
} }
} }
if( body != null ) if( !body.accept( action ) ) return false;
if( condition != null ) if( !condition.accept( action ) ) return false; if (body != null && !body.accept(action)) return false;
if (condition != null && !condition.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;
@ -105,14 +105,12 @@ public class CPPASTDoStatement extends ASTNode implements IASTDoStatement, IASTA
@Override @Override
public void replace(IASTNode child, IASTNode other) { public void replace(IASTNode child, IASTNode other) {
if( body == child ) if (body == child) {
{
other.setPropertyInParent(body.getPropertyInParent()); other.setPropertyInParent(body.getPropertyInParent());
other.setParent(body.getParent()); other.setParent(body.getParent());
body = (IASTStatement) other; body = (IASTStatement) other;
} }
if( child == condition ) if (child == condition) {
{
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent()); other.setParent(child.getParent());
condition = (IASTExpression) other; condition = (IASTExpression) other;

View file

@ -22,7 +22,6 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
*/ */
public class CPPASTExpressionStatement extends ASTNode implements public class CPPASTExpressionStatement extends ASTNode implements
IASTExpressionStatement, IASTAmbiguityParent { IASTExpressionStatement, IASTAmbiguityParent {
private IASTExpression expression; private IASTExpression expression;
public CPPASTExpressionStatement() { public CPPASTExpressionStatement() {

View file

@ -19,10 +19,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
* @author jcamelon * @author jcamelon
*/ */
public class CPPASTGotoStatement extends ASTNode implements IASTGotoStatement { public class CPPASTGotoStatement extends ASTNode implements IASTGotoStatement {
private IASTName name; private IASTName name;
public CPPASTGotoStatement() { public CPPASTGotoStatement() {
} }
@ -69,7 +67,8 @@ public class CPPASTGotoStatement extends ASTNode implements IASTGotoStatement {
default : break; default : break;
} }
} }
if( name != null ) if( !name.accept( action ) ) return false;
if (name != null && !name.accept(action)) return false;
if (action.shouldVisitStatements) { if (action.shouldVisitStatements) {
switch (action.leave(this)) { switch (action.leave(this)) {

View file

@ -158,6 +158,7 @@ public class CPPASTIfStatement extends ASTNode implements ICPPASTIfStatement, IA
break loop; break loop;
} }
} }
if (action.shouldVisitStatements) { if (action.shouldVisitStatements) {
if (stmt != null && action.leave(stmt) == ASTVisitor.PROCESS_ABORT) if (stmt != null && action.leave(stmt) == ASTVisitor.PROCESS_ABORT)
return false; return false;

View file

@ -26,8 +26,7 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* e.g.: int a[]= {1,2,3}; * e.g.: int a[]= {1,2,3};
*/ */
public class CPPASTInitializerList extends ASTNode implements ICPPASTInitializerList, IASTAmbiguityParent { public class CPPASTInitializerList extends ASTNode implements ICPPASTInitializerList, IASTAmbiguityParent {
private IASTInitializerClause [] initializers;
private IASTInitializerClause [] initializers = null;
private int initializersPos= -1; private int initializersPos= -1;
private int actualSize; private int actualSize;
private boolean fIsPackExpansion; private boolean fIsPackExpansion;
@ -40,8 +39,9 @@ public class CPPASTInitializerList extends ASTNode implements ICPPASTInitializer
@Override @Override
public CPPASTInitializerList copy(CopyStyle style) { public CPPASTInitializerList copy(CopyStyle style) {
CPPASTInitializerList copy = new CPPASTInitializerList(); CPPASTInitializerList copy = new CPPASTInitializerList();
for (IASTInitializerClause initializer : getClauses()) for (IASTInitializerClause initializer : getClauses()) {
copy.addClause(initializer == null ? null : initializer.copy(style)); copy.addClause(initializer == null ? null : initializer.copy(style));
}
copy.setOffsetAndLength(this); copy.setOffsetAndLength(this);
copy.actualSize = getSize(); copy.actualSize = getSize();
copy.fIsPackExpansion = fIsPackExpansion; copy.fIsPackExpansion = fIsPackExpansion;

View file

@ -21,13 +21,11 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/** /**
* @author jcamelon * @author jcamelon
*/ */
public class CPPASTLabelStatement extends ASTNode implements public class CPPASTLabelStatement extends ASTNode
IASTLabelStatement, IASTAmbiguityParent { implements IASTLabelStatement, IASTAmbiguityParent {
private IASTName name; private IASTName name;
private IASTStatement nestedStatement; private IASTStatement nestedStatement;
public CPPASTLabelStatement() { public CPPASTLabelStatement() {
} }
@ -77,8 +75,9 @@ public class CPPASTLabelStatement extends ASTNode implements
default: break; default: break;
} }
} }
if( name != null ) if( !name.accept( action ) ) return false;
if( nestedStatement != null ) if( !nestedStatement.accept( action ) ) return false; if (name != null && !name.accept(action)) return false;
if (nestedStatement != null && !nestedStatement.accept(action)) return false;
if (action.shouldVisitStatements) { if (action.shouldVisitStatements) {
switch (action.leave(this)) { switch (action.leave(this)) {
@ -113,12 +112,10 @@ public class CPPASTLabelStatement extends ASTNode implements
@Override @Override
public void replace(IASTNode child, IASTNode other) { public void replace(IASTNode child, IASTNode other) {
if( child == nestedStatement ) if (child == nestedStatement) {
{
other.setParent(this); other.setParent(this);
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
setNestedStatement((IASTStatement) other); setNestedStatement((IASTStatement) other);
} }
} }
} }

View file

@ -62,5 +62,4 @@ public class CPPASTProblemDeclaration extends CPPASTProblemOwner implements IAST
} }
return true; return true;
} }
} }

View file

@ -20,10 +20,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
* @author jcamelon * @author jcamelon
*/ */
abstract class CPPASTProblemOwner extends ASTNode implements IASTProblemHolder { abstract class CPPASTProblemOwner extends ASTNode implements IASTProblemHolder {
private IASTProblem problem; private IASTProblem problem;
public CPPASTProblemOwner() { public CPPASTProblemOwner() {
} }

View file

@ -21,6 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IASTProblemTypeId;
* @author jcamelon * @author jcamelon
*/ */
public class CPPASTProblemTypeId extends CPPASTProblemOwner implements IASTProblemTypeId { public class CPPASTProblemTypeId extends CPPASTProblemOwner implements IASTProblemTypeId {
public CPPASTProblemTypeId() { public CPPASTProblemTypeId() {
} }
@ -52,7 +53,7 @@ public class CPPASTProblemTypeId extends CPPASTProblemOwner implements IASTProbl
default: break; default: break;
} }
// Visits the problem // Visit the problem
if (!super.accept(action)) if (!super.accept(action))
return false; return false;

View file

@ -77,16 +77,13 @@ public class CPPASTReturnStatement extends ASTNode implements IASTReturnStatemen
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: case ASTVisitor.PROCESS_ABORT: return false;
return false; case ASTVisitor.PROCESS_SKIP: return true;
case ASTVisitor.PROCESS_SKIP: default: break;
return true;
default:
break;
} }
} }
if (retValue != null && !retValue.accept(action))
return false; if (retValue != null && !retValue.accept(action)) return false;
if (action.shouldVisitStatements) { if (action.shouldVisitStatements) {
switch (action.leave(this)) { switch (action.leave(this)) {

View file

@ -41,8 +41,9 @@ public class CPPASTSimpleDeclaration extends ASTNode implements IASTSimpleDeclar
public CPPASTSimpleDeclaration copy(CopyStyle style) { public CPPASTSimpleDeclaration copy(CopyStyle style) {
CPPASTSimpleDeclaration copy = new CPPASTSimpleDeclaration(); CPPASTSimpleDeclaration copy = new CPPASTSimpleDeclaration();
copy.setDeclSpecifier(declSpecifier == null ? null : declSpecifier.copy(style)); copy.setDeclSpecifier(declSpecifier == null ? null : declSpecifier.copy(style));
for (IASTDeclarator declarator : getDeclarators()) for (IASTDeclarator declarator : getDeclarators()) {
copy.addDeclarator(declarator == null ? null : declarator.copy(style)); copy.addDeclarator(declarator == null ? null : declarator.copy(style));
}
copy.setOffsetAndLength(this); copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) { if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this); copy.setCopyLocation(this);
@ -129,5 +130,4 @@ public class CPPASTSimpleDeclaration extends ASTNode implements IASTSimpleDeclar
} }
} }
} }
} }

View file

@ -104,6 +104,7 @@ public class CPPASTSwitchStatement extends ASTNode
default: break; default: break;
} }
} }
if (controllerExpression != null && !controllerExpression.accept(action)) return false; if (controllerExpression != null && !controllerExpression.accept(action)) return false;
if (controllerDeclaration != null && !controllerDeclaration.accept(action)) return false; if (controllerDeclaration != null && !controllerDeclaration.accept(action)) return false;
if (body != null && !body.accept(action)) return false; if (body != null && !body.accept(action)) return false;

View file

@ -24,10 +24,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode; import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
public class CPPASTUsingDeclaration extends ASTNode public class CPPASTUsingDeclaration extends ASTNode
implements ICPPASTUsingDeclaration, ICPPASTCompletionContext { implements ICPPASTUsingDeclaration, ICPPASTCompletionContext {
private boolean typeName; private boolean typeName;
private IASTName name; private IASTName name;
@ -45,8 +43,8 @@ public class CPPASTUsingDeclaration extends ASTNode
@Override @Override
public CPPASTUsingDeclaration copy(CopyStyle style) { public CPPASTUsingDeclaration copy(CopyStyle style) {
CPPASTUsingDeclaration copy = new CPPASTUsingDeclaration(name == null ? null CPPASTUsingDeclaration copy =
: name.copy(style)); new CPPASTUsingDeclaration(name == null ? null : name.copy(style));
copy.typeName = typeName; copy.typeName = typeName;
copy.setOffsetAndLength(this); copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) { if (style == CopyStyle.withLocations) {
@ -91,7 +89,7 @@ public class CPPASTUsingDeclaration extends ASTNode
} }
} }
if (name != null) if (!name.accept(action)) return false; if (name != null && !name.accept(action)) return false;
if (action.shouldVisitDeclarations) { if (action.shouldVisitDeclarations) {
switch(action.leave(this)) { switch(action.leave(this)) {

View file

@ -23,10 +23,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode; import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
public class CPPASTUsingDirective extends ASTNode
public class CPPASTUsingDirective extends ASTNode implements implements ICPPASTUsingDirective, ICPPASTCompletionContext {
ICPPASTUsingDirective, ICPPASTCompletionContext {
private IASTName name; private IASTName name;
public CPPASTUsingDirective() { public CPPASTUsingDirective() {
@ -64,7 +62,6 @@ public class CPPASTUsingDirective extends ASTNode implements
qualifiedName.setParent(this); qualifiedName.setParent(this);
qualifiedName.setPropertyInParent(QUALIFIED_NAME); qualifiedName.setPropertyInParent(QUALIFIED_NAME);
} }
} }
@Override @Override
@ -77,7 +74,7 @@ public class CPPASTUsingDirective extends ASTNode implements
} }
} }
if( name != null ) if( !name.accept( action ) ) return false; if (name != null && !name.accept(action)) return false;
if (action.shouldVisitDeclarations) { if (action.shouldVisitDeclarations) {
switch (action.leave(this)) { switch (action.leave(this)) {
@ -89,7 +86,6 @@ public class CPPASTUsingDirective extends ASTNode implements
return true; return true;
} }
@Override @Override
public int getRoleForName(IASTName n) { public int getRoleForName(IASTName n) {
if (n == name) if (n == name)

View file

@ -18,11 +18,9 @@ import org.eclipse.cdt.internal.core.dom.parser.c.CASTForStatement;
@SuppressWarnings("restriction") @SuppressWarnings("restriction")
public class UPCASTForallStatement extends CASTForStatement implements IUPCASTForallStatement { public class UPCASTForallStatement extends CASTForStatement implements IUPCASTForallStatement {
private IASTExpression affinity; private IASTExpression affinity;
private boolean affinityContinue; private boolean affinityContinue;
public UPCASTForallStatement() { public UPCASTForallStatement() {
} }
@ -40,15 +38,14 @@ public class UPCASTForallStatement extends CASTForStatement implements IUPCASTFo
@Override @Override
public UPCASTForallStatement copy(CopyStyle style) { public UPCASTForallStatement copy(CopyStyle style) {
UPCASTForallStatement copy = new UPCASTForallStatement(); UPCASTForallStatement copy = new UPCASTForallStatement();
copyForStatement(copy, style);
copy.setAffinityExpression(affinity == null ? null : affinity.copy(style)); copy.setAffinityExpression(affinity == null ? null : affinity.copy(style));
copyForStatement(copy, style);
if (style == CopyStyle.withLocations) { if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this); copy.setCopyLocation(this);
} }
return copy; return copy;
} }
@Override @Override
public boolean isAffinityContinue() { public boolean isAffinityContinue() {
return affinityContinue; return affinityContinue;
@ -77,7 +74,6 @@ public class UPCASTForallStatement extends CASTForStatement implements IUPCASTFo
this.affinityContinue = affinityContinue; this.affinityContinue = affinityContinue;
} }
@Override @Override
public boolean accept(ASTVisitor visitor) { public boolean accept(ASTVisitor visitor) {
if (visitor.shouldVisitStatements) { if (visitor.shouldVisitStatements) {
@ -88,18 +84,18 @@ public class UPCASTForallStatement extends CASTForStatement implements IUPCASTFo
} }
IASTStatement initializer = super.getInitializerStatement(); IASTStatement initializer = super.getInitializerStatement();
if(initializer != null) if(!initializer.accept(visitor)) return false; if (initializer != null && !initializer.accept(visitor)) return false;
IASTExpression condition = super.getConditionExpression(); IASTExpression condition = super.getConditionExpression();
if(condition != null) if(!condition.accept(visitor)) return false; if (condition != null && !condition.accept(visitor)) return false;
IASTExpression iteration = super.getIterationExpression(); IASTExpression iteration = super.getIterationExpression();
if(iteration != null) if(!iteration.accept(visitor)) return false; if (iteration != null && !iteration.accept(visitor)) return false;
if(affinity != null) if(!affinity.accept(visitor)) return false; if (affinity != null && !affinity.accept(visitor)) return false;
IASTStatement body = super.getBody(); IASTStatement body = super.getBody();
if(body != null) if(!body.accept(visitor)) return false; if (body != null && !body.accept(visitor)) return false;
if (visitor.shouldVisitStatements) { if (visitor.shouldVisitStatements) {
switch (visitor.leave(this)) { switch (visitor.leave(this)) {
@ -107,8 +103,6 @@ public class UPCASTForallStatement extends CASTForStatement implements IUPCASTFo
case ASTVisitor.PROCESS_SKIP: return true; case ASTVisitor.PROCESS_SKIP: return true;
} }
} }
return true; return true;
} }
} }

View file

@ -17,10 +17,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
@SuppressWarnings("restriction") @SuppressWarnings("restriction")
public class UPCASTSynchronizationStatement extends ASTNode implements IUPCASTSynchronizationStatement { public class UPCASTSynchronizationStatement extends ASTNode implements IUPCASTSynchronizationStatement {
private int statmentKind; private int statmentKind;
private IASTExpression barrierExpression = null; private IASTExpression barrierExpression;
public UPCASTSynchronizationStatement() { public UPCASTSynchronizationStatement() {
} }
@ -71,7 +69,6 @@ public class UPCASTSynchronizationStatement extends ASTNode implements IUPCASTSy
this.statmentKind = kind; this.statmentKind = kind;
} }
@Override @Override
public boolean accept(ASTVisitor visitor) { public boolean accept(ASTVisitor visitor) {
if (visitor.shouldVisitStatements) { if (visitor.shouldVisitStatements) {
@ -81,11 +78,7 @@ public class UPCASTSynchronizationStatement extends ASTNode implements IUPCASTSy
} }
} }
if(barrierExpression != null) { if (barrierExpression != null && !barrierExpression.accept(visitor)) return false;
boolean abort = !barrierExpression.accept(visitor);
if(abort)
return false;
}
if (visitor.shouldVisitStatements) { if (visitor.shouldVisitStatements) {
switch (visitor.leave(this)) { switch (visitor.leave(this)) {
@ -93,8 +86,6 @@ public class UPCASTSynchronizationStatement extends ASTNode implements IUPCASTSy
case ASTVisitor.PROCESS_SKIP: return true; case ASTVisitor.PROCESS_SKIP: return true;
} }
} }
return true; return true;
} }
} }