1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 22:22: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

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Doug Schaefer (IBM) - Initial API and implementation
* Doug Schaefer (IBM) - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast;

View file

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

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* John Camelon (IBM) - Initial API and implementation
* John Camelon (IBM) - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp;
@ -16,14 +16,13 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
/**
* This interface represents a namespace alias in C++. e.g. namespace ABC { int
* x; } namspace DEF = ABC;
* This interface represents a namespace alias in C++,
* e.g. namespace ABC { int* x; } namespace DEF = ABC;
*
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPASTNamespaceAlias extends IASTDeclaration, IASTNameOwner {
/**
* <code>ALIAS_NAME</code> represents the new namespace name being
* introduced.
@ -68,7 +67,6 @@ public interface ICPPASTNamespaceAlias extends IASTDeclaration, IASTNameOwner {
*/
public void setMappingName(IASTName qualifiedName);
/**
* @since 5.1
*/
@ -80,5 +78,4 @@ public interface ICPPASTNamespaceAlias extends IASTDeclaration, IASTNameOwner {
*/
@Override
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

@ -6,15 +6,13 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* IBM - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser;
import org.eclipse.cdt.core.dom.ast.IASTNode;
public interface IASTAmbiguityParent {
public void replace( IASTNode child, IASTNode other );
public void replace(IASTNode child, IASTNode other);
}

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* IBM - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser;
@ -14,9 +14,9 @@ import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.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

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - Initial API and implementation
* Markus Schorn - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -31,7 +31,6 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTInternalScope;
* @since 5.0.1
*/
public class CASTAmbiguousSimpleDeclaration extends ASTAmbiguousNode implements IASTAmbiguousSimpleDeclaration {
private IASTSimpleDeclaration fSimpleDecl;
private IASTDeclSpecifier fAltDeclSpec;
private IASTDeclarator fAltDtor;

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -24,9 +24,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTInternalScope;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPASTInternalScope;
public class CASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAmbiguousStatement {
private IASTStatement [] stmts = new IASTStatement[2];
private int stmtsPos=-1;
private IASTStatement[] stmts = new IASTStatement[2];
private int stmtsPos= -1;
private IScope fScope;
private IASTDeclaration fDeclaration;
@ -73,7 +72,7 @@ public class CASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAmbi
public void addStatement(IASTStatement s) {
assertNotFrozen();
if (s != null) {
stmts = ArrayUtil.appendAt( IASTStatement.class, stmts, ++stmtsPos, s );
stmts = ArrayUtil.appendAt(IASTStatement.class, stmts, ++stmtsPos, s);
s.setParent(this);
s.setPropertyInParent(STATEMENT);
}
@ -81,7 +80,7 @@ public class CASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAmbi
@Override
public IASTStatement[] getStatements() {
stmts = ArrayUtil.trimAt( IASTStatement.class, stmts, stmtsPos );
stmts = ArrayUtil.trimAt(IASTStatement.class, stmts, stmtsPos);
return stmts;
}
@ -90,7 +89,6 @@ public class CASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAmbi
return getStatements();
}
@Override
public IASTStatement copy() {
throw new UnsupportedOperationException();
@ -100,5 +98,4 @@ public class CASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAmbi
public IASTStatement copy(CopyStyle style) {
throw new UnsupportedOperationException();
}
}

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
* IBM Rational Software - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -19,22 +19,21 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
* @author jcamelon
*/
public class CASTBreakStatement extends ASTNode implements IASTBreakStatement {
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitStatements ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (action.shouldVisitStatements) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
* IBM Rational Software - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -22,10 +22,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* @author jcamelon
*/
public class CASTCaseStatement extends ASTNode implements IASTCaseStatement, IASTAmbiguityParent {
private IASTExpression expression;
public CASTCaseStatement() {
}
@ -64,20 +62,20 @@ public class CASTCaseStatement extends ASTNode implements IASTCaseStatement, IAS
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitStatements ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
if( expression != null ) if( !expression.accept( action ) ) return false;
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (expression != null) if (!expression.accept(action)) return false;
if (action.shouldVisitStatements) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
@ -86,10 +84,9 @@ public class CASTCaseStatement extends ASTNode implements IASTCaseStatement, IAS
@Override
public void replace(IASTNode child, IASTNode other) {
if( child == expression )
{
other.setPropertyInParent( child.getPropertyInParent() );
other.setParent( child.getParent() );
if (child == expression) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
expression = (IASTExpression) other;
}
}

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
* IBM Rational Software - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -19,26 +19,25 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
* @author jcamelon
*/
public class CASTDefaultStatement extends ASTNode implements IASTDefaultStatement {
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitStatements ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (action.shouldVisitStatements) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;
}
@Override
public CASTDefaultStatement copy() {
return copy(CopyStyle.withoutLocations);

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
* IBM Rational Software - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -23,11 +23,9 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* @author jcamelon
*/
public class CASTDoStatement extends ASTNode implements IASTDoStatement, IASTAmbiguityParent {
private IASTStatement body;
private IASTExpression condition;
public CASTDoStatement() {
}
@ -68,13 +66,11 @@ public class CASTDoStatement extends ASTNode implements IASTDoStatement, IASTAmb
}
}
@Override
public IASTExpression getCondition() {
return condition;
}
@Override
public void setCondition(IASTExpression condition) {
assertNotFrozen();
@ -86,21 +82,23 @@ public class CASTDoStatement extends ASTNode implements IASTDoStatement, IASTAmb
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitStatements ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
if( body != null ) if( !body.accept( action ) ) return false;
if( condition != null ) if( !condition.accept( action ) ) return false;
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (body != null && !body.accept(action)) return false;
if (condition != null && !condition.accept(action)) return false;
if (action.shouldVisitStatements) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;
@ -108,16 +106,14 @@ public class CASTDoStatement extends ASTNode implements IASTDoStatement, IASTAmb
@Override
public void replace(IASTNode child, IASTNode other) {
if( body == child )
{
other.setPropertyInParent( body.getPropertyInParent() );
other.setParent( body.getParent() );
if (body == child) {
other.setPropertyInParent(body.getPropertyInParent());
other.setParent(body.getParent());
body = (IASTStatement) other;
}
if( child == condition )
{
other.setPropertyInParent( child.getPropertyInParent() );
other.setParent( child.getParent() );
if (child == condition) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
condition = (IASTExpression) other;
}
}

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
* IBM Rational Software - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -23,10 +23,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
*/
public class CASTExpressionStatement extends ASTNode implements
IASTExpressionStatement, IASTAmbiguityParent {
private IASTExpression expression;
public CASTExpressionStatement() {
}
@ -69,26 +67,19 @@ public class CASTExpressionStatement extends ASTNode implements
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT:
return false;
case ASTVisitor.PROCESS_SKIP:
return true;
default:
break;
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
if (expression != null)
if (!expression.accept(action))
return false;
if (expression != null && !expression.accept(action)) return false;
if (action.shouldVisitStatements) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT:
return false;
case ASTVisitor.PROCESS_SKIP:
return true;
default:
break;
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
@ -103,5 +94,4 @@ public class CASTExpressionStatement extends ASTNode implements
expression = (IASTExpression) other;
}
}
}

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
* IBM Rational Software - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -25,12 +25,11 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* @author jcamelon
*/
public class CASTForStatement extends ASTNode implements IASTForStatement, IASTAmbiguityParent {
private IScope scope = null;
private IScope scope;
private IASTExpression condition;
private IASTExpression iterationExpression;
private IASTStatement body, init;
private IASTStatement body;
private IASTStatement init;
public CASTForStatement() {
}
@ -61,8 +60,8 @@ public class CASTForStatement extends ASTNode implements IASTForStatement, IASTA
protected void copyForStatement(CASTForStatement copy, CopyStyle style) {
copy.setInitializerStatement(init == null ? null : init.copy(style));
copy.setConditionExpression(condition == null ? null : condition.copy(style));
copy.setIterationExpression(iterationExpression == null ? null : iterationExpression
.copy(style));
copy.setIterationExpression(iterationExpression == null ?
null : iterationExpression.copy(style));
copy.setBody(body == null ? null : body.copy(style));
copy.setOffsetAndLength(this);
}
@ -128,62 +127,56 @@ public class CASTForStatement extends ASTNode implements IASTForStatement, IASTA
@Override
public IScope getScope() {
if( scope == null )
scope = new CScope( this, EScopeKind.eLocal);
if (scope == null)
scope = new CScope(this, EScopeKind.eLocal);
return scope;
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitStatements ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
if( init != null ) if( !init.accept( action ) ) return false;
if( condition != null ) if( !condition.accept( action ) ) return false;
if( iterationExpression != null ) if( !iterationExpression.accept( action ) ) return false;
if( body != null ) if( !body.accept( action ) ) return false;
if (init != null && !init.accept(action)) return false;
if (condition != null && !condition.accept(action)) return false;
if (iterationExpression != null && !iterationExpression.accept(action)) return false;
if (body != null && !body.accept(action)) return false;
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (action.shouldVisitStatements) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;
}
@Override
public void replace(IASTNode child, IASTNode other) {
if( body == child )
{
other.setPropertyInParent( child.getPropertyInParent() );
other.setParent( child.getParent() );
if (body == child) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
body = (IASTStatement) other;
}
if( child == init )
{
other.setPropertyInParent( child.getPropertyInParent() );
other.setParent( child.getParent() );
if (child == init) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
init = (IASTStatement) other;
}
if( child == iterationExpression)
{
other.setPropertyInParent( child.getPropertyInParent() );
other.setParent( child.getParent() );
if (child == iterationExpression) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
iterationExpression = (IASTExpression) other;
}
if( child == condition)
{
other.setPropertyInParent( child.getPropertyInParent() );
other.setParent( child.getParent() );
if (child == condition) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
condition = (IASTExpression) other;
}
}
}

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
* IBM Rational Software - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -20,7 +20,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
* @author jcamelon
*/
public class CASTGotoStatement extends ASTNode implements IASTGotoStatement {
private IASTName name;
public CASTGotoStatement() {
@ -51,31 +50,32 @@ public class CASTGotoStatement extends ASTNode implements IASTGotoStatement {
}
@Override
public void setName(IASTName name) {
assertNotFrozen();
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(NAME);
}
public void setName(IASTName name) {
assertNotFrozen();
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(NAME);
}
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitStatements ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
if( name != null ) if( !name.accept( action ) ) return false;
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (name != null && !name.accept(action)) return false;
if (action.shouldVisitStatements) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;
@ -83,7 +83,7 @@ public class CASTGotoStatement extends ASTNode implements IASTGotoStatement {
@Override
public int getRoleForName(IASTName n) {
if( n == name ) return r_reference;
if (n == name) return r_reference;
return r_unclear;
}
}

View file

@ -6,9 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* John Camelon (IBM Rational Software) - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
* Markus Schorn (Wind River Systems)
* John Camelon (IBM Rational Software) - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -24,12 +24,9 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* If statements for C.
*/
public class CASTIfStatement extends ASTNode implements IASTIfStatement, IASTAmbiguityParent {
private IASTExpression condition;
private IASTStatement thenClause;
private IASTStatement elseClause;
public CASTIfStatement() {
}
@ -39,7 +36,6 @@ public class CASTIfStatement extends ASTNode implements IASTIfStatement, IASTAmb
setThenClause(thenClause);
}
public CASTIfStatement(IASTExpression condition, IASTStatement thenClause, IASTStatement elseClause) {
this(condition, thenClause);
setElseClause(elseClause);
@ -165,22 +161,19 @@ public class CASTIfStatement extends ASTNode implements IASTIfStatement, IASTAmb
@Override
public void replace(IASTNode child, IASTNode other) {
if( thenClause == child )
{
other.setParent( child.getParent() );
other.setPropertyInParent( child.getPropertyInParent() );
if (thenClause == child) {
other.setParent(child.getParent());
other.setPropertyInParent(child.getPropertyInParent());
thenClause = (IASTStatement) other;
}
if( elseClause == child )
{
other.setParent( child.getParent() );
other.setPropertyInParent( child.getPropertyInParent() );
if (elseClause == child) {
other.setParent(child.getParent());
other.setPropertyInParent(child.getPropertyInParent());
elseClause = (IASTStatement) other;
}
if( child == condition )
{
other.setPropertyInParent( child.getPropertyInParent() );
other.setParent( child.getParent() );
if (child == condition) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
condition = (IASTExpression) other;
}
}

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
* IBM Rational Software - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -19,21 +19,21 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
* @author jcamelon
*/
public class CASTNullStatement extends ASTNode implements IASTNullStatement {
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitStatements ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (action.shouldVisitStatements) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;

View file

@ -6,9 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
* Markus Schorn (Wind River Systems)
* IBM - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -19,8 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTProblemDeclaration;
/**
* @author jcamelon
*/
public class CASTProblemDeclaration extends CASTProblemOwner implements
IASTProblemDeclaration {
public class CASTProblemDeclaration extends CASTProblemOwner implements IASTProblemDeclaration {
public CASTProblemDeclaration() {
super();
@ -46,20 +45,22 @@ public class CASTProblemDeclaration extends CASTProblemOwner implements
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitDeclarations ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitDeclarations) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
super.accept(action); // visits the problem
if( action.shouldVisitDeclarations ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (action.shouldVisitDeclarations) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;

View file

@ -6,9 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* John Camelon (IBM) - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
* Markus Schorn (Wind River Systems)
* John Camelon (IBM) - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -45,20 +45,22 @@ public class CASTProblemExpression extends CASTProblemOwner implements IASTProbl
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitExpressions ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitExpressions) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
super.accept(action); // visits the problem
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (action.shouldVisitExpressions) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -20,7 +20,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
* @author jcamelon
*/
abstract class CASTProblemOwner extends ASTNode implements IASTProblemHolder {
private IASTProblem problem;
public CASTProblemOwner() {
@ -51,17 +50,17 @@ abstract class CASTProblemOwner extends ASTNode implements IASTProblemHolder {
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitProblems ){
switch( action.visit( getProblem() ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action){
if (action.shouldVisitProblems) {
switch (action.visit(getProblem())) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
switch( action.leave( getProblem() ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
switch (action.leave(getProblem())) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;

View file

@ -6,9 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
* Markus Schorn (Wind River Systems)
* IBM - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -44,20 +44,22 @@ public class CASTProblemStatement extends CASTProblemOwner implements IASTProble
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitStatements ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
super.accept(action); // visits the problem
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (action.shouldVisitStatements) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
* IBM Rational Software - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -22,9 +22,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* @author jcamelon
*/
public class CASTSwitchStatement extends ASTNode implements
IASTSwitchStatement, IASTAmbiguityParent {
public class CASTSwitchStatement extends ASTNode
implements IASTSwitchStatement, IASTAmbiguityParent {
private IASTExpression controller;
private IASTStatement body;
@ -84,22 +83,23 @@ public class CASTSwitchStatement extends ASTNode implements
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitStatements ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
if( controller != null ) if( !controller.accept( action ) ) return false;
if( body != null ) if( !body.accept( action ) ) return false;
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (controller != null && !controller.accept(action)) return false;
if (body != null && !body.accept(action)) return false;
if (action.shouldVisitStatements) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;
@ -107,16 +107,14 @@ public class CASTSwitchStatement extends ASTNode implements
@Override
public void replace(IASTNode child, IASTNode other) {
if( body == child )
{
other.setPropertyInParent( child.getPropertyInParent() );
other.setParent( child.getParent() );
if (body == child) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
body = (IASTStatement) other;
}
if( child == controller )
{
other.setPropertyInParent( child.getPropertyInParent() );
other.setParent( child.getParent() );
if (child == controller) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
controller = (IASTExpression) other;
}
}

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - Initial API and implementation
* Markus Schorn - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -33,7 +33,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
* };
*/
public class CPPASTAmbiguousSimpleDeclaration extends ASTAmbiguousNode implements IASTAmbiguousSimpleDeclaration {
private IASTSimpleDeclaration fSimpleDecl;
private IASTDeclSpecifier fAltDeclSpec;
private IASTDeclarator fAltDtor;
@ -55,7 +54,7 @@ public class CPPASTAmbiguousSimpleDeclaration extends ASTAmbiguousNode implement
@Override
public IASTNode[] getNodes() {
return new IASTNode[] {fSimpleDecl, fAltDeclSpec, fAltDtor};
return new IASTNode[] { fSimpleDecl, fAltDeclSpec, fAltDtor };
}
@Override
@ -97,7 +96,6 @@ public class CPPASTAmbiguousSimpleDeclaration extends ASTAmbiguousNode implement
owner.replace(nodeToReplace, fSimpleDecl);
IASTDeclarator dtor= fSimpleDecl.getDeclarators()[0];
dtor.accept(resolver);
// find nested names
final NameCollector nameCollector= new NameCollector();

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -23,16 +23,14 @@ 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.CPPVisitor;
public class CPPASTAmbiguousStatement extends ASTAmbiguousNode implements
IASTAmbiguousStatement {
private IASTStatement [] stmts = new IASTStatement[2];
private int stmtsPos=-1;
public class CPPASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAmbiguousStatement {
private IASTStatement[] stmts = new IASTStatement[2];
private int stmtsPos= -1;
private IScope fScope;
private IASTDeclaration fDeclaration;
public CPPASTAmbiguousStatement(IASTStatement... statements) {
for(IASTStatement s : statements)
for (IASTStatement s : statements)
addStatement(s);
}
@ -84,7 +82,7 @@ public class CPPASTAmbiguousStatement extends ASTAmbiguousNode implements
public void addStatement(IASTStatement s) {
assertNotFrozen();
if (s != null) {
stmts = ArrayUtil.appendAt( IASTStatement.class, stmts, ++stmtsPos, s );
stmts = ArrayUtil.appendAt(IASTStatement.class, stmts, ++stmtsPos, s);
s.setParent(this);
s.setPropertyInParent(STATEMENT);
}
@ -92,7 +90,7 @@ public class CPPASTAmbiguousStatement extends ASTAmbiguousNode implements
@Override
public IASTStatement[] getStatements() {
stmts = ArrayUtil.trimAt( IASTStatement.class, stmts, stmtsPos );
stmts = ArrayUtil.trimAt(IASTStatement.class, stmts, stmtsPos);
return stmts;
}

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* IBM - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -21,7 +21,6 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* @author jcamelon
*/
public class CPPASTCaseStatement extends ASTNode implements IASTCaseStatement, IASTAmbiguityParent {
private IASTExpression expression;
public CPPASTCaseStatement() {
@ -38,8 +37,8 @@ public class CPPASTCaseStatement extends ASTNode implements IASTCaseStatement, I
@Override
public CPPASTCaseStatement copy(CopyStyle style) {
CPPASTCaseStatement copy = new CPPASTCaseStatement(expression == null ? null
: expression.copy(style));
CPPASTCaseStatement copy =
new CPPASTCaseStatement(expression == null ? null : expression.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
@ -63,18 +62,19 @@ public class CPPASTCaseStatement extends ASTNode implements IASTCaseStatement, I
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitStatements ){
switch( action.visit( this ) ){
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
switch(action.visit(this)) {
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
if( expression != null ) if( !expression.accept( action ) ) return false;
if (expression != null && !expression.accept(action)) return false;
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
if (action.shouldVisitStatements) {
switch(action.leave(this)) {
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
@ -85,10 +85,9 @@ public class CPPASTCaseStatement extends ASTNode implements IASTCaseStatement, I
@Override
public void replace(IASTNode child, IASTNode other) {
if( child == expression )
{
other.setPropertyInParent( child.getPropertyInParent() );
other.setParent( child.getParent() );
if (child == expression) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
expression = (IASTExpression) other;
}
}

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* IBM - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -22,11 +22,9 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* @author jcamelon
*/
public class CPPASTDoStatement extends ASTNode implements IASTDoStatement, IASTAmbiguityParent {
private IASTStatement body;
private IASTExpression condition;
public CPPASTDoStatement() {
}
@ -83,21 +81,23 @@ public class CPPASTDoStatement extends ASTNode implements IASTDoStatement, IASTA
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitStatements ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
if( body != null ) if( !body.accept( action ) ) return false;
if( condition != null ) if( !condition.accept( action ) ) return false;
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (body != null && !body.accept(action)) return false;
if (condition != null && !condition.accept(action)) return false;
if (action.shouldVisitStatements) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;
@ -105,16 +105,14 @@ public class CPPASTDoStatement extends ASTNode implements IASTDoStatement, IASTA
@Override
public void replace(IASTNode child, IASTNode other) {
if( body == child )
{
other.setPropertyInParent( body.getPropertyInParent() );
other.setParent( body.getParent() );
if (body == child) {
other.setPropertyInParent(body.getPropertyInParent());
other.setParent(body.getParent());
body = (IASTStatement) other;
}
if( child == condition )
{
other.setPropertyInParent( child.getPropertyInParent() );
other.setParent( child.getParent() );
if (child == condition) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
condition = (IASTExpression) other;
}
}

View file

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

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* IBM - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -19,9 +19,7 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
* @author jcamelon
*/
public class CPPASTGotoStatement extends ASTNode implements IASTGotoStatement {
private IASTName name;
public CPPASTGotoStatement() {
}
@ -51,28 +49,29 @@ public class CPPASTGotoStatement extends ASTNode implements IASTGotoStatement {
}
@Override
public void setName(IASTName name) {
assertNotFrozen();
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(NAME);
}
public void setName(IASTName name) {
assertNotFrozen();
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(NAME);
}
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitStatements ){
switch( action.visit( this ) ){
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
if( name != null ) if( !name.accept( action ) ) return false;
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
if (name != null && !name.accept(action)) return false;
if (action.shouldVisitStatements) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
@ -83,7 +82,7 @@ public class CPPASTGotoStatement extends ASTNode implements IASTGotoStatement {
@Override
public int getRoleForName(IASTName n) {
if( name == n ) return r_reference;
if (name == n) return r_reference;
return r_unclear;
}
}

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -158,6 +158,7 @@ public class CPPASTIfStatement extends ASTNode implements ICPPASTIfStatement, IA
break loop;
}
}
if (action.shouldVisitStatements) {
if (stmt != null && action.leave(stmt) == ASTVisitor.PROCESS_ABORT)
return false;
@ -207,8 +208,8 @@ public class CPPASTIfStatement extends ASTNode implements ICPPASTIfStatement, IA
@Override
public IScope getScope() {
if( scope == null )
scope = new CPPBlockScope( this );
if (scope == null)
scope = new CPPBlockScope(this);
return scope;
}
}

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -26,9 +26,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* e.g.: int a[]= {1,2,3};
*/
public class CPPASTInitializerList extends ASTNode implements ICPPASTInitializerList, IASTAmbiguityParent {
private IASTInitializerClause [] initializers = null;
private int initializersPos=-1;
private IASTInitializerClause [] initializers;
private int initializersPos= -1;
private int actualSize;
private boolean fIsPackExpansion;
@ -40,8 +39,9 @@ public class CPPASTInitializerList extends ASTNode implements ICPPASTInitializer
@Override
public CPPASTInitializerList copy(CopyStyle style) {
CPPASTInitializerList copy = new CPPASTInitializerList();
for (IASTInitializerClause initializer : getClauses())
for (IASTInitializerClause initializer : getClauses()) {
copy.addClause(initializer == null ? null : initializer.copy(style));
}
copy.setOffsetAndLength(this);
copy.actualSize = getSize();
copy.fIsPackExpansion = fIsPackExpansion;
@ -114,9 +114,9 @@ public class CPPASTInitializerList extends ASTNode implements ICPPASTInitializer
public boolean accept( ASTVisitor action ){
if (action.shouldVisitInitializers) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
IASTInitializerClause[] list = getClauses();

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* IBM - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -21,12 +21,10 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* @author jcamelon
*/
public class CPPASTLabelStatement extends ASTNode implements
IASTLabelStatement, IASTAmbiguityParent {
public class CPPASTLabelStatement extends ASTNode
implements IASTLabelStatement, IASTAmbiguityParent {
private IASTName name;
private IASTStatement nestedStatement;
public CPPASTLabelStatement() {
}
@ -69,22 +67,23 @@ public class CPPASTLabelStatement extends ASTNode implements
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitStatements ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
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 ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (action.shouldVisitStatements) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;
@ -92,7 +91,7 @@ public class CPPASTLabelStatement extends ASTNode implements
@Override
public int getRoleForName(IASTName n) {
if( n == name ) return r_declaration;
if (n == name) return r_declaration;
return r_unclear;
}
@ -113,12 +112,10 @@ public class CPPASTLabelStatement extends ASTNode implements
@Override
public void replace(IASTNode child, IASTNode other) {
if( child == nestedStatement )
{
other.setParent( this );
other.setPropertyInParent( child.getPropertyInParent() );
if (child == nestedStatement) {
other.setParent(this);
other.setPropertyInParent(child.getPropertyInParent());
setNestedStatement((IASTStatement) other);
}
}
}

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -32,7 +32,7 @@ public class CPPASTProblemDeclaration extends CPPASTProblemOwner implements IAST
public CPPASTProblemDeclaration copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public CPPASTProblemDeclaration copy(CopyStyle style) {
CPPASTProblemDeclaration copy = new CPPASTProblemDeclaration();
@ -42,25 +42,24 @@ public class CPPASTProblemDeclaration extends CPPASTProblemOwner implements IAST
}
return copy;
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitDeclarations ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitDeclarations) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
super.accept(action); // visits the problem
if( action.shouldVisitDeclarations ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (action.shouldVisitDeclarations) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;
}
}

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -44,20 +44,20 @@ public class CPPASTProblemExpression extends CPPASTProblemOwner implements IASTP
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitExpressions ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitExpressions) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
super.accept(action); // visits the problem
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (action.shouldVisitExpressions) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -20,17 +20,15 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
* @author jcamelon
*/
abstract class CPPASTProblemOwner extends ASTNode implements IASTProblemHolder {
private IASTProblem problem;
public CPPASTProblemOwner() {
}
public CPPASTProblemOwner(IASTProblem problem) {
setProblem(problem);
}
protected void copyBaseProblem(CPPASTProblemOwner copy, CopyStyle style) {
copy.setProblem(problem == null ? null : problem.copy(style));
copy.setOffsetAndLength(this);
@ -52,17 +50,17 @@ abstract class CPPASTProblemOwner extends ASTNode implements IASTProblemHolder {
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitProblems ){
switch( action.visit( getProblem() ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitProblems) {
switch (action.visit(getProblem())) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
switch( action.leave( getProblem() ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
switch (action.leave(getProblem())) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -27,7 +27,7 @@ public class CPPASTProblemStatement extends CPPASTProblemOwner implements IASTPr
public CPPASTProblemStatement(IASTProblem problem) {
super(problem);
}
@Override
public CPPASTProblemStatement copy() {
return copy(CopyStyle.withoutLocations);
@ -44,20 +44,20 @@ public class CPPASTProblemStatement extends CPPASTProblemOwner implements IASTPr
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitStatements ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
super.accept(action); // visits the problem
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (action.shouldVisitStatements) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -21,6 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IASTProblemTypeId;
* @author jcamelon
*/
public class CPPASTProblemTypeId extends CPPASTProblemOwner implements IASTProblemTypeId {
public CPPASTProblemTypeId() {
}
@ -52,7 +53,7 @@ public class CPPASTProblemTypeId extends CPPASTProblemOwner implements IASTProbl
default: break;
}
// Visits the problem
// Visit the problem
if (!super.accept(action))
return false;

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - Initial API and implementation
* Markus Schorn - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -178,9 +178,9 @@ public class CPPASTRangeBasedForStatement extends ASTNode implements ICPPASTRang
public boolean accept( ASTVisitor action ){
if (action.shouldVisitStatements) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
if (fDeclaration != null && !fDeclaration.accept(action))

View file

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

View file

@ -41,8 +41,9 @@ public class CPPASTSimpleDeclaration extends ASTNode implements IASTSimpleDeclar
public CPPASTSimpleDeclaration copy(CopyStyle style) {
CPPASTSimpleDeclaration copy = new CPPASTSimpleDeclaration();
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.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
@ -129,5 +130,4 @@ public class CPPASTSimpleDeclaration extends ASTNode implements IASTSimpleDeclar
}
}
}
}

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -104,6 +104,7 @@ public class CPPASTSwitchStatement extends ASTNode
default: break;
}
}
if (controllerExpression != null && !controllerExpression.accept(action)) return false;
if (controllerDeclaration != null && !controllerDeclaration.accept(action)) return false;
if (body != null && !body.accept(action)) return false;

View file

@ -1,14 +1,14 @@
/*******************************************************************************
* Copyright (c) 2004, 2011 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
* Copyright (c) 2004, 2011 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:
* John Camelon (IBM) - Initial API and implementation
* Bryan Wilkinson (QNX)
* Markus Schorn (Wind River Systems)
* Contributors:
* John Camelon (IBM) - Initial API and implementation
* Bryan Wilkinson (QNX)
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -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.cpp.semantics.CPPSemantics;
public class CPPASTUsingDeclaration extends ASTNode
implements ICPPASTUsingDeclaration, ICPPASTCompletionContext {
private boolean typeName;
private IASTName name;
@ -45,8 +43,8 @@ public class CPPASTUsingDeclaration extends ASTNode
@Override
public CPPASTUsingDeclaration copy(CopyStyle style) {
CPPASTUsingDeclaration copy = new CPPASTUsingDeclaration(name == null ? null
: name.copy(style));
CPPASTUsingDeclaration copy =
new CPPASTUsingDeclaration(name == null ? null : name.copy(style));
copy.typeName = typeName;
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
@ -85,19 +83,19 @@ public class CPPASTUsingDeclaration extends ASTNode
public boolean accept(ASTVisitor action) {
if (action.shouldVisitDeclarations) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
if (name != null) if (!name.accept(action)) return false;
if (name != null && !name.accept(action)) return false;
if (action.shouldVisitDeclarations) {
switch(action.leave(this)) {
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* John Camelon (IBM) - Initial API and implementation
* Bryan Wilkinson (QNX)
* John Camelon (IBM) - Initial API and implementation
* Bryan Wilkinson (QNX)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -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.cpp.semantics.CPPSemantics;
public class CPPASTUsingDirective extends ASTNode implements
ICPPASTUsingDirective, ICPPASTCompletionContext {
public class CPPASTUsingDirective extends ASTNode
implements ICPPASTUsingDirective, ICPPASTCompletionContext {
private IASTName name;
public CPPASTUsingDirective() {
@ -64,35 +62,33 @@ public class CPPASTUsingDirective extends ASTNode implements
qualifiedName.setParent(this);
qualifiedName.setPropertyInParent(QUALIFIED_NAME);
}
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitDeclarations ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitDeclarations) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
if( name != null ) if( !name.accept( action ) ) return false;
if (name != null && !name.accept(action)) return false;
if( action.shouldVisitDeclarations ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (action.shouldVisitDeclarations) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;
}
@Override
@Override
public int getRoleForName(IASTName n) {
if( n == name )
if (n == name)
return r_reference;
return r_unclear;
}

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.upc.ast;
@ -18,11 +18,9 @@ import org.eclipse.cdt.internal.core.dom.parser.c.CASTForStatement;
@SuppressWarnings("restriction")
public class UPCASTForallStatement extends CASTForStatement implements IUPCASTForallStatement {
private IASTExpression affinity;
private boolean affinityContinue;
public UPCASTForallStatement() {
}
@ -40,15 +38,14 @@ public class UPCASTForallStatement extends CASTForStatement implements IUPCASTFo
@Override
public UPCASTForallStatement copy(CopyStyle style) {
UPCASTForallStatement copy = new UPCASTForallStatement();
copyForStatement(copy, style);
copy.setAffinityExpression(affinity == null ? null : affinity.copy(style));
copyForStatement(copy, style);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
}
@Override
public boolean isAffinityContinue() {
return affinityContinue;
@ -61,10 +58,10 @@ public class UPCASTForallStatement extends CASTForStatement implements IUPCASTFo
@Override
public void setAffinityExpression(IASTExpression affinity) {
if(affinity != null)
if (affinity != null)
this.affinityContinue = false;
this.affinity = affinity;
if(affinity != null) {
if (affinity != null) {
affinity.setParent(this);
affinity.setPropertyInParent(AFFINITY);
}
@ -72,43 +69,40 @@ public class UPCASTForallStatement extends CASTForStatement implements IUPCASTFo
@Override
public void setAffinityContinue(boolean affinityContinue) {
if(affinityContinue)
if (affinityContinue)
this.affinity = null;
this.affinityContinue = affinityContinue;
}
@Override
public boolean accept(ASTVisitor visitor) {
if(visitor.shouldVisitStatements) {
switch(visitor.visit(this)){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
if (visitor.shouldVisitStatements) {
switch (visitor.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
}
}
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();
if(condition != null) if(!condition.accept(visitor)) return false;
if (condition != null && !condition.accept(visitor)) return false;
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();
if(body != null) if(!body.accept(visitor)) return false;
if (body != null && !body.accept(visitor)) return false;
if(visitor.shouldVisitStatements) {
switch(visitor.leave(this)){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
if (visitor.shouldVisitStatements) {
switch (visitor.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
}
}
return true;
}
}

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.upc.ast;
@ -17,10 +17,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
@SuppressWarnings("restriction")
public class UPCASTSynchronizationStatement extends ASTNode implements IUPCASTSynchronizationStatement {
private int statmentKind;
private IASTExpression barrierExpression = null;
private IASTExpression barrierExpression;
public UPCASTSynchronizationStatement() {
}
@ -41,7 +39,7 @@ public class UPCASTSynchronizationStatement extends ASTNode implements IUPCASTSy
copy.statmentKind = statmentKind;
copy.setBarrierExpression(barrierExpression == null ? null : barrierExpression.copy(style));
copy.setOffsetAndLength(this);
if(style == CopyStyle.withLocations) {
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
@ -60,7 +58,7 @@ public class UPCASTSynchronizationStatement extends ASTNode implements IUPCASTSy
@Override
public void setBarrierExpression(IASTExpression expr) {
this.barrierExpression = expr;
if(expr != null) {
if (expr != null) {
expr.setParent(this);
expr.setPropertyInParent(BARRIER_EXPRESSION);
}
@ -71,30 +69,23 @@ public class UPCASTSynchronizationStatement extends ASTNode implements IUPCASTSy
this.statmentKind = kind;
}
@Override
public boolean accept(ASTVisitor visitor) {
if(visitor.shouldVisitStatements) {
switch(visitor.visit(this)) {
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
if (visitor.shouldVisitStatements) {
switch (visitor.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
}
}
if(barrierExpression != null) {
boolean abort = !barrierExpression.accept(visitor);
if(abort)
return false;
}
if (barrierExpression != null && !barrierExpression.accept(visitor)) return false;
if(visitor.shouldVisitStatements) {
switch(visitor.leave(this)) {
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
if (visitor.shouldVisitStatements) {
switch (visitor.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
}
}
return true;
}
}