mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 03:45:35 +02:00
Cosmetics.
This commit is contained in:
parent
c602341aad
commit
666817a093
5 changed files with 108 additions and 101 deletions
|
@ -40,5 +40,4 @@ public interface ICPPASTFieldReference extends IASTFieldReference, IASTImplicitN
|
|||
* @since 5.1
|
||||
*/
|
||||
public ICPPASTFieldReference copy();
|
||||
|
||||
}
|
||||
|
|
|
@ -106,18 +106,22 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
|
|||
setInitOperand2(expression);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner#getImplicitNames()
|
||||
*/
|
||||
public IASTImplicitName[] getImplicitNames() {
|
||||
if (implicitNames == null) {
|
||||
ICPPFunction overload = getOverload();
|
||||
if (overload == null)
|
||||
return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
||||
|
||||
if (overload == null) {
|
||||
implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
||||
} else {
|
||||
CPPASTImplicitName operatorName = new CPPASTImplicitName(overload.getNameCharArray(), this);
|
||||
operatorName.setBinding(overload);
|
||||
operatorName.setOperator(true);
|
||||
operatorName.computeOperatorOffsets(operand1, true);
|
||||
implicitNames = new IASTImplicitName[] { operatorName };
|
||||
}
|
||||
}
|
||||
|
||||
return implicitNames;
|
||||
}
|
||||
|
@ -149,7 +153,6 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
|
|||
if (operand2 != null && !operand2.accept(action))
|
||||
return false;
|
||||
|
||||
|
||||
if (action.shouldVisitExpressions && action.leave(this) == ASTVisitor.PROCESS_ABORT)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -25,14 +25,12 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
|
|||
|
||||
|
||||
public class CPPASTDeleteExpression extends ASTNode implements ICPPASTDeleteExpression {
|
||||
|
||||
private IASTExpression operand;
|
||||
private boolean isGlobal;
|
||||
private boolean isVectored;
|
||||
|
||||
private IASTImplicitName[] implicitNames = null;
|
||||
|
||||
|
||||
public CPPASTDeleteExpression() {
|
||||
}
|
||||
|
||||
|
@ -87,12 +85,12 @@ public class CPPASTDeleteExpression extends ASTNode implements ICPPASTDeleteExpr
|
|||
* Try to resolve both the destructor and operator delete.
|
||||
*/
|
||||
public IASTImplicitName[] getImplicitNames() {
|
||||
if(implicitNames == null) {
|
||||
if (implicitNames == null) {
|
||||
List<IASTImplicitName> names = new ArrayList<IASTImplicitName>();
|
||||
|
||||
if(!isVectored) {
|
||||
if (!isVectored) {
|
||||
ICPPFunction destructor = CPPSemantics.findDestructor(this);
|
||||
if(destructor != null) {
|
||||
if (destructor != null) {
|
||||
CPPASTImplicitName destructorName = new CPPASTImplicitName(destructor.getNameCharArray(), this);
|
||||
destructorName.setBinding(destructor);
|
||||
destructorName.computeOperatorOffsets(operand, false);
|
||||
|
@ -100,9 +98,9 @@ public class CPPASTDeleteExpression extends ASTNode implements ICPPASTDeleteExpr
|
|||
}
|
||||
}
|
||||
|
||||
if(!isGlobal) {
|
||||
if (!isGlobal) {
|
||||
ICPPFunction deleteOperator = CPPSemantics.findOverloadedOperator(this);
|
||||
if(deleteOperator != null) {
|
||||
if (deleteOperator != null) {
|
||||
CPPASTImplicitName deleteName = new CPPASTImplicitName(deleteOperator.getNameCharArray(), this);
|
||||
deleteName.setOperator(true);
|
||||
deleteName.setBinding(deleteOperator);
|
||||
|
@ -111,7 +109,7 @@ public class CPPASTDeleteExpression extends ASTNode implements ICPPASTDeleteExpr
|
|||
}
|
||||
}
|
||||
|
||||
if(names.isEmpty())
|
||||
if (names.isEmpty())
|
||||
implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
||||
else
|
||||
implicitNames = names.toArray(new IASTImplicitName[names.size()]);
|
||||
|
@ -120,30 +118,31 @@ public class CPPASTDeleteExpression extends ASTNode implements ICPPASTDeleteExpr
|
|||
return implicitNames;
|
||||
}
|
||||
|
||||
|
||||
@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(action.shouldVisitImplicitNames) {
|
||||
if (action.shouldVisitImplicitNames) {
|
||||
for(IASTImplicitName name : getImplicitNames()) {
|
||||
if(!name.accept(action)) return false;
|
||||
if (!name.accept(action))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if( operand != null ) if( !operand.accept( action ) ) return false;
|
||||
if (operand != null && !operand.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;
|
||||
|
|
|
@ -63,7 +63,7 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
|
|||
copy.setIsNewTypeId(isNewTypeId);
|
||||
if (placement != null) {
|
||||
IASTInitializerClause[] plcmt = new IASTInitializerClause[placement.length];
|
||||
for (int i=0; i<placement.length; i++) {
|
||||
for (int i= 0; i < placement.length; i++) {
|
||||
plcmt[i]= placement[i].copy();
|
||||
}
|
||||
copy.setPlacementArguments(plcmt);
|
||||
|
@ -133,13 +133,15 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
|
|||
isNewTypeId = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner#getImplicitNames()
|
||||
*/
|
||||
public IASTImplicitName[] getImplicitNames() {
|
||||
if(implicitNames == null) {
|
||||
if (implicitNames == null) {
|
||||
ICPPFunction operatorFunction = CPPSemantics.findOverloadedOperator(this);
|
||||
if(operatorFunction == null) {
|
||||
if (operatorFunction == null) {
|
||||
implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
CPPASTImplicitName operatorName = new CPPASTImplicitName(operatorFunction.getNameCharArray(), this);
|
||||
operatorName.setOperator(true);
|
||||
operatorName.setBinding(operatorFunction);
|
||||
|
@ -151,7 +153,6 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
|
|||
return implicitNames;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if this expression is allocating an array.
|
||||
* @since 5.1
|
||||
|
@ -163,18 +164,18 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
|
|||
|
||||
|
||||
@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(action.shouldVisitImplicitNames) {
|
||||
if (action.shouldVisitImplicitNames) {
|
||||
for(IASTImplicitName name : getImplicitNames()) {
|
||||
if(!name.accept(action)) return false;
|
||||
if (!name.accept(action)) return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -190,11 +191,11 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
|
|||
if (initializer != null && !initializer.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;
|
||||
|
|
|
@ -94,18 +94,22 @@ public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpres
|
|||
return op == op_postFixDecr || op == op_postFixIncr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner#getImplicitNames()
|
||||
*/
|
||||
public IASTImplicitName[] getImplicitNames() {
|
||||
if (implicitNames == null) {
|
||||
ICPPFunction overload = getOverload();
|
||||
if (overload == null)
|
||||
return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
||||
|
||||
if (overload == null) {
|
||||
implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
||||
} else {
|
||||
CPPASTImplicitName operatorName = new CPPASTImplicitName(overload.getNameCharArray(), this);
|
||||
operatorName.setOperator(true);
|
||||
operatorName.setBinding(overload);
|
||||
operatorName.computeOperatorOffsets(operand, isPostfixOperator());
|
||||
implicitNames = new IASTImplicitName[] { operatorName };
|
||||
}
|
||||
}
|
||||
|
||||
return implicitNames;
|
||||
}
|
||||
|
@ -116,7 +120,7 @@ public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpres
|
|||
switch (action.visit(this)) {
|
||||
case ASTVisitor.PROCESS_ABORT: return false;
|
||||
case ASTVisitor.PROCESS_SKIP: return true;
|
||||
default : break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,7 +138,8 @@ public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpres
|
|||
|
||||
if (isPostfix && action.shouldVisitImplicitNames) {
|
||||
for (IASTImplicitName name : getImplicitNames()) {
|
||||
if (!name.accept(action)) return false;
|
||||
if (!name.accept(action))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue