mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Cosmetics.
This commit is contained in:
parent
411047a2e4
commit
60322d05d5
5 changed files with 57 additions and 59 deletions
|
@ -94,9 +94,9 @@ public class CPPASTArraySubscriptExpression extends ASTNode implements ICPPASTAr
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTImplicitName[] getImplicitNames() {
|
public IASTImplicitName[] getImplicitNames() {
|
||||||
if(implicitNames == null) {
|
if (implicitNames == null) {
|
||||||
ICPPFunction overload = getOverload();
|
ICPPFunction overload = getOverload();
|
||||||
if(overload == null)
|
if (overload == null)
|
||||||
return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
||||||
|
|
||||||
// create separate implicit names for the two brackets
|
// create separate implicit names for the two brackets
|
||||||
|
@ -129,49 +129,47 @@ public class CPPASTArraySubscriptExpression extends ASTNode implements ICPPASTAr
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept(ASTVisitor action) {
|
||||||
if( action.shouldVisitExpressions ){
|
if (action.shouldVisitExpressions) {
|
||||||
switch( action.visit( this ) ){
|
switch (action.visit(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( arrayExpression != null )
|
if (arrayExpression != null && !arrayExpression.accept(action))
|
||||||
if( !arrayExpression.accept( action ) ) return false;
|
return false;
|
||||||
|
|
||||||
IASTImplicitName[] implicits = action.shouldVisitImplicitNames ? getImplicitNames() : null;
|
IASTImplicitName[] implicits = action.shouldVisitImplicitNames ? getImplicitNames() : null;
|
||||||
|
|
||||||
if(implicits != null && implicits.length > 0)
|
if (implicits != null && implicits.length > 0 && !implicits[0].accept(action))
|
||||||
if(!implicits[0].accept(action)) return false;
|
return false;
|
||||||
|
|
||||||
if( subscriptExp != null )
|
if (subscriptExp != null && !subscriptExp.accept(action))
|
||||||
if( !subscriptExp.accept( action ) ) return false;
|
return false;
|
||||||
|
|
||||||
if(implicits != null && implicits.length > 0)
|
if (implicits != null && implicits.length > 0 && !implicits[1].accept(action))
|
||||||
if(!implicits[1].accept(action)) return false;
|
return false;
|
||||||
|
|
||||||
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void replace(IASTNode child, IASTNode other) {
|
public void replace(IASTNode child, IASTNode other) {
|
||||||
if( child == subscriptExp )
|
if (child == subscriptExp) {
|
||||||
{
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
other.setParent(child.getParent());
|
||||||
other.setParent( child.getParent() );
|
|
||||||
subscriptExp = (IASTExpression) other;
|
subscriptExp = (IASTExpression) other;
|
||||||
}
|
}
|
||||||
if( child == arrayExpression )
|
if (child == arrayExpression) {
|
||||||
{
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
other.setParent(child.getParent());
|
||||||
other.setParent( child.getParent() );
|
|
||||||
arrayExpression = (IASTExpression) other;
|
arrayExpression = (IASTExpression) other;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
|
||||||
switch (action.visit(this)) {
|
switch (action.visit(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT: return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP: return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,8 +117,8 @@ public class CPPASTFieldReference extends ASTNode implements ICPPASTFieldReferen
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTImplicitName[] getImplicitNames() {
|
public IASTImplicitName[] getImplicitNames() {
|
||||||
if(implicitNames == null) {
|
if (implicitNames == null) {
|
||||||
if(!isDeref)
|
if (!isDeref)
|
||||||
return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
||||||
|
|
||||||
// collect the function bindings
|
// collect the function bindings
|
||||||
|
@ -128,7 +128,7 @@ public class CPPASTFieldReference extends ASTNode implements ICPPASTFieldReferen
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
||||||
}
|
}
|
||||||
if(functionBindings.isEmpty())
|
if (functionBindings.isEmpty())
|
||||||
return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
||||||
|
|
||||||
// create a name to wrap each binding
|
// 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) {
|
if (action.shouldVisitImplicitNames) {
|
||||||
for(IASTImplicitName name : getImplicitNames()) {
|
for (IASTImplicitName name : getImplicitNames()) {
|
||||||
if(!name.accept(action)) return false;
|
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) {
|
if (action.shouldVisitExpressions) {
|
||||||
switch (action.leave(this)) {
|
switch (action.leave(this)) {
|
||||||
|
|
|
@ -107,9 +107,9 @@ public class CPPASTFunctionCallExpression extends ASTNode implements
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTImplicitName[] getImplicitNames() {
|
public IASTImplicitName[] getImplicitNames() {
|
||||||
if(implicitNames == null) {
|
if (implicitNames == null) {
|
||||||
ICPPFunction overload = getOperator();
|
ICPPFunction overload = getOperator();
|
||||||
if(overload == null)
|
if (overload == null)
|
||||||
return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
||||||
|
|
||||||
// create separate implicit names for the two brackets
|
// create separate implicit names for the two brackets
|
||||||
|
@ -126,12 +126,12 @@ public class CPPASTFunctionCallExpression extends ASTNode implements
|
||||||
IToken lparen = functionName.getTrailingSyntax();
|
IToken lparen = functionName.getTrailingSyntax();
|
||||||
IToken rparen = lparen.getNext();
|
IToken rparen = lparen.getNext();
|
||||||
|
|
||||||
if(lparen.getType() == IToken.tLPAREN)
|
if (lparen.getType() == IToken.tLPAREN)
|
||||||
n1.setOffsetAndLength(idEndOffset + lparen.getOffset(), 1);
|
n1.setOffsetAndLength(idEndOffset + lparen.getOffset(), 1);
|
||||||
else
|
else
|
||||||
n1.setOffsetAndLength(idEndOffset + lparen.getEndOffset(), 0);
|
n1.setOffsetAndLength(idEndOffset + lparen.getEndOffset(), 0);
|
||||||
|
|
||||||
if(rparen.getType() == IToken.tRPAREN)
|
if (rparen.getType() == IToken.tRPAREN)
|
||||||
n2.setOffsetAndLength(idEndOffset + rparen.getOffset(), 1);
|
n2.setOffsetAndLength(idEndOffset + rparen.getOffset(), 1);
|
||||||
else
|
else
|
||||||
n2.setOffsetAndLength(idEndOffset + rparen.getEndOffset(), 0);
|
n2.setOffsetAndLength(idEndOffset + rparen.getEndOffset(), 0);
|
||||||
|
@ -150,12 +150,12 @@ public class CPPASTFunctionCallExpression extends ASTNode implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept(ASTVisitor action) {
|
||||||
if( action.shouldVisitExpressions ){
|
if (action.shouldVisitExpressions) {
|
||||||
switch( action.visit( this ) ){
|
switch (action.visit(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,18 +164,16 @@ public class CPPASTFunctionCallExpression extends ASTNode implements
|
||||||
|
|
||||||
IASTImplicitName[] implicits = action.shouldVisitImplicitNames ? getImplicitNames() : null;
|
IASTImplicitName[] implicits = action.shouldVisitImplicitNames ? getImplicitNames() : null;
|
||||||
|
|
||||||
if (implicits != null && implicits.length > 0)
|
if (implicits != null && implicits.length > 0 && !implicits[0].accept(action))
|
||||||
if (!implicits[0].accept(action))
|
return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
for (IASTInitializerClause arg : fArguments) {
|
for (IASTInitializerClause arg : fArguments) {
|
||||||
if (!arg.accept(action))
|
if (!arg.accept(action))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (implicits != null && implicits.length > 0)
|
if (implicits != null && implicits.length > 0 && !implicits[1].accept(action))
|
||||||
if (!implicits[1].accept(action))
|
return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
if (action.shouldVisitExpressions && action.leave(this) == ASTVisitor.PROCESS_ABORT)
|
if (action.shouldVisitExpressions && action.leave(this) == ASTVisitor.PROCESS_ABORT)
|
||||||
return false;
|
return false;
|
||||||
|
@ -252,7 +250,7 @@ public class CPPASTFunctionCallExpression extends ASTNode implements
|
||||||
if (op != null) {
|
if (op != null) {
|
||||||
// overload can be a surrogate function call, which consists of a conversion and a call to
|
// overload can be a surrogate function call, which consists of a conversion and a call to
|
||||||
// a dynamically computed function pointer.
|
// a dynamically computed function pointer.
|
||||||
if(!(op instanceof CPPImplicitFunction))
|
if (!(op instanceof CPPImplicitFunction))
|
||||||
overload = op;
|
overload = op;
|
||||||
return op.getType().getReturnType();
|
return op.getType().getReturnType();
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,11 +162,10 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
|
||||||
return t instanceof IArrayType;
|
return t instanceof IArrayType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(ASTVisitor action) {
|
public boolean accept(ASTVisitor action) {
|
||||||
if (action.shouldVisitExpressions) {
|
if (action.shouldVisitExpressions) {
|
||||||
switch(action.visit(this)) {
|
switch (action.visit(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT: return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP: return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default: break;
|
default: break;
|
||||||
|
@ -174,7 +173,7 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action.shouldVisitImplicitNames) {
|
if (action.shouldVisitImplicitNames) {
|
||||||
for(IASTImplicitName name : getImplicitNames()) {
|
for (IASTImplicitName name : getImplicitNames()) {
|
||||||
if (!name.accept(action)) return false;
|
if (!name.accept(action)) return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue