diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArraySubscriptExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArraySubscriptExpression.java index 377639ab364..f12c5b4d292 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArraySubscriptExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArraySubscriptExpression.java @@ -94,9 +94,9 @@ public class CPPASTArraySubscriptExpression extends ASTNode implements ICPPASTAr } public IASTImplicitName[] getImplicitNames() { - if(implicitNames == null) { + if (implicitNames == null) { ICPPFunction overload = getOverload(); - if(overload == null) + if (overload == null) return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; // create separate implicit names for the two brackets @@ -129,49 +129,47 @@ public class CPPASTArraySubscriptExpression extends ASTNode implements ICPPASTAr } @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; } } - if( arrayExpression != null ) - if( !arrayExpression.accept( action ) ) return false; + if (arrayExpression != null && !arrayExpression.accept(action)) + return false; IASTImplicitName[] implicits = action.shouldVisitImplicitNames ? getImplicitNames() : null; - if(implicits != null && implicits.length > 0) - if(!implicits[0].accept(action)) return false; + if (implicits != null && implicits.length > 0 && !implicits[0].accept(action)) + return false; - if( subscriptExp != null ) - if( !subscriptExp.accept( action ) ) return false; + if (subscriptExp != null && !subscriptExp.accept(action)) + return false; - if(implicits != null && implicits.length > 0) - if(!implicits[1].accept(action)) return false; + if (implicits != null && implicits.length > 0 && !implicits[1].accept(action)) + return false; - 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; } public void replace(IASTNode child, IASTNode other) { - if( child == subscriptExp ) - { - other.setPropertyInParent( child.getPropertyInParent() ); - other.setParent( child.getParent() ); + if (child == subscriptExp) { + other.setPropertyInParent(child.getPropertyInParent()); + other.setParent(child.getParent()); subscriptExp = (IASTExpression) other; } - if( child == arrayExpression ) - { - other.setPropertyInParent( child.getPropertyInParent() ); - other.setParent( child.getParent() ); + if (child == arrayExpression) { + other.setPropertyInParent(child.getPropertyInParent()); + other.setParent(child.getParent()); arrayExpression = (IASTExpression) other; } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java index eee69838bc5..5a3c4c6bd7f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java @@ -136,7 +136,7 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr switch (action.visit(this)) { case ASTVisitor.PROCESS_ABORT: return false; case ASTVisitor.PROCESS_SKIP: return true; - default : break; + default: break; } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java index 314236c2332..ecf2753c3db 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java @@ -117,8 +117,8 @@ public class CPPASTFieldReference extends ASTNode implements ICPPASTFieldReferen } public IASTImplicitName[] getImplicitNames() { - if(implicitNames == null) { - if(!isDeref) + if (implicitNames == null) { + if (!isDeref) return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; // collect the function bindings @@ -128,7 +128,7 @@ public class CPPASTFieldReference extends ASTNode implements ICPPASTFieldReferen } catch (DOMException e) { return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; } - if(functionBindings.isEmpty()) + if (functionBindings.isEmpty()) return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; // create a name to wrap each binding @@ -154,15 +154,18 @@ public class CPPASTFieldReference extends ASTNode implements ICPPASTFieldReferen } } - if (owner != null && !owner.accept(action)) return false; + if (owner != null && !owner.accept(action)) + return false; - if(action.shouldVisitImplicitNames) { - for(IASTImplicitName name : getImplicitNames()) { - if(!name.accept(action)) return false; + if (action.shouldVisitImplicitNames) { + for (IASTImplicitName name : getImplicitNames()) { + if (!name.accept(action)) + return false; } } - if (name != null && !name.accept(action)) return false; + if (name != null && !name.accept(action)) + return false; if (action.shouldVisitExpressions) { switch (action.leave(this)) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionCallExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionCallExpression.java index c733370c585..f5b0405d874 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionCallExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionCallExpression.java @@ -107,9 +107,9 @@ public class CPPASTFunctionCallExpression extends ASTNode implements } public IASTImplicitName[] getImplicitNames() { - if(implicitNames == null) { + if (implicitNames == null) { ICPPFunction overload = getOperator(); - if(overload == null) + if (overload == null) return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; // create separate implicit names for the two brackets @@ -126,12 +126,12 @@ public class CPPASTFunctionCallExpression extends ASTNode implements IToken lparen = functionName.getTrailingSyntax(); IToken rparen = lparen.getNext(); - if(lparen.getType() == IToken.tLPAREN) + if (lparen.getType() == IToken.tLPAREN) n1.setOffsetAndLength(idEndOffset + lparen.getOffset(), 1); else n1.setOffsetAndLength(idEndOffset + lparen.getEndOffset(), 0); - if(rparen.getType() == IToken.tRPAREN) + if (rparen.getType() == IToken.tRPAREN) n2.setOffsetAndLength(idEndOffset + rparen.getOffset(), 1); else n2.setOffsetAndLength(idEndOffset + rparen.getEndOffset(), 0); @@ -150,12 +150,12 @@ public class CPPASTFunctionCallExpression extends ASTNode implements } @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; } } @@ -164,18 +164,16 @@ public class CPPASTFunctionCallExpression extends ASTNode implements IASTImplicitName[] implicits = action.shouldVisitImplicitNames ? getImplicitNames() : null; - if (implicits != null && implicits.length > 0) - if (!implicits[0].accept(action)) - return false; + if (implicits != null && implicits.length > 0 && !implicits[0].accept(action)) + return false; for (IASTInitializerClause arg : fArguments) { if (!arg.accept(action)) return false; } - if (implicits != null && implicits.length > 0) - if (!implicits[1].accept(action)) - return false; + if (implicits != null && implicits.length > 0 && !implicits[1].accept(action)) + return false; if (action.shouldVisitExpressions && action.leave(this) == ASTVisitor.PROCESS_ABORT) return false; @@ -252,7 +250,7 @@ public class CPPASTFunctionCallExpression extends ASTNode implements if (op != null) { // overload can be a surrogate function call, which consists of a conversion and a call to // a dynamically computed function pointer. - if(!(op instanceof CPPImplicitFunction)) + if (!(op instanceof CPPImplicitFunction)) overload = op; return op.getType().getReturnType(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNewExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNewExpression.java index 98a620c58bf..c55c2bd5ed2 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNewExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNewExpression.java @@ -161,12 +161,11 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression IType t = CPPVisitor.createType(getTypeId()); return t instanceof IArrayType; } - - + @Override public boolean accept(ASTVisitor action) { if (action.shouldVisitExpressions) { - switch(action.visit(this)) { + switch (action.visit(this)) { case ASTVisitor.PROCESS_ABORT: return false; case ASTVisitor.PROCESS_SKIP: return true; default: break; @@ -174,7 +173,7 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression } if (action.shouldVisitImplicitNames) { - for(IASTImplicitName name : getImplicitNames()) { + for (IASTImplicitName name : getImplicitNames()) { if (!name.accept(action)) return false; } }