mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 11:55:40 +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
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
public ICPPASTFieldReference copy();
|
public ICPPASTFieldReference copy();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,18 +106,22 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
|
||||||
setInitOperand2(expression);
|
setInitOperand2(expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner#getImplicitNames()
|
||||||
|
*/
|
||||||
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;
|
implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
||||||
|
} else {
|
||||||
CPPASTImplicitName operatorName = new CPPASTImplicitName(overload.getNameCharArray(), this);
|
CPPASTImplicitName operatorName = new CPPASTImplicitName(overload.getNameCharArray(), this);
|
||||||
operatorName.setBinding(overload);
|
operatorName.setBinding(overload);
|
||||||
operatorName.setOperator(true);
|
operatorName.setOperator(true);
|
||||||
operatorName.computeOperatorOffsets(operand1, true);
|
operatorName.computeOperatorOffsets(operand1, true);
|
||||||
implicitNames = new IASTImplicitName[] { operatorName };
|
implicitNames = new IASTImplicitName[] { operatorName };
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return implicitNames;
|
return implicitNames;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +153,6 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
|
||||||
if (operand2 != null && !operand2.accept(action))
|
if (operand2 != null && !operand2.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;
|
||||||
|
|
||||||
|
|
|
@ -25,14 +25,12 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
|
||||||
|
|
||||||
|
|
||||||
public class CPPASTDeleteExpression extends ASTNode implements ICPPASTDeleteExpression {
|
public class CPPASTDeleteExpression extends ASTNode implements ICPPASTDeleteExpression {
|
||||||
|
|
||||||
private IASTExpression operand;
|
private IASTExpression operand;
|
||||||
private boolean isGlobal;
|
private boolean isGlobal;
|
||||||
private boolean isVectored;
|
private boolean isVectored;
|
||||||
|
|
||||||
private IASTImplicitName[] implicitNames = null;
|
private IASTImplicitName[] implicitNames = null;
|
||||||
|
|
||||||
|
|
||||||
public CPPASTDeleteExpression() {
|
public CPPASTDeleteExpression() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,12 +85,12 @@ public class CPPASTDeleteExpression extends ASTNode implements ICPPASTDeleteExpr
|
||||||
* Try to resolve both the destructor and operator delete.
|
* Try to resolve both the destructor and operator delete.
|
||||||
*/
|
*/
|
||||||
public IASTImplicitName[] getImplicitNames() {
|
public IASTImplicitName[] getImplicitNames() {
|
||||||
if(implicitNames == null) {
|
if (implicitNames == null) {
|
||||||
List<IASTImplicitName> names = new ArrayList<IASTImplicitName>();
|
List<IASTImplicitName> names = new ArrayList<IASTImplicitName>();
|
||||||
|
|
||||||
if(!isVectored) {
|
if (!isVectored) {
|
||||||
ICPPFunction destructor = CPPSemantics.findDestructor(this);
|
ICPPFunction destructor = CPPSemantics.findDestructor(this);
|
||||||
if(destructor != null) {
|
if (destructor != null) {
|
||||||
CPPASTImplicitName destructorName = new CPPASTImplicitName(destructor.getNameCharArray(), this);
|
CPPASTImplicitName destructorName = new CPPASTImplicitName(destructor.getNameCharArray(), this);
|
||||||
destructorName.setBinding(destructor);
|
destructorName.setBinding(destructor);
|
||||||
destructorName.computeOperatorOffsets(operand, false);
|
destructorName.computeOperatorOffsets(operand, false);
|
||||||
|
@ -100,9 +98,9 @@ public class CPPASTDeleteExpression extends ASTNode implements ICPPASTDeleteExpr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isGlobal) {
|
if (!isGlobal) {
|
||||||
ICPPFunction deleteOperator = CPPSemantics.findOverloadedOperator(this);
|
ICPPFunction deleteOperator = CPPSemantics.findOverloadedOperator(this);
|
||||||
if(deleteOperator != null) {
|
if (deleteOperator != null) {
|
||||||
CPPASTImplicitName deleteName = new CPPASTImplicitName(deleteOperator.getNameCharArray(), this);
|
CPPASTImplicitName deleteName = new CPPASTImplicitName(deleteOperator.getNameCharArray(), this);
|
||||||
deleteName.setOperator(true);
|
deleteName.setOperator(true);
|
||||||
deleteName.setBinding(deleteOperator);
|
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;
|
implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
||||||
else
|
else
|
||||||
implicitNames = names.toArray(new IASTImplicitName[names.size()]);
|
implicitNames = names.toArray(new IASTImplicitName[names.size()]);
|
||||||
|
@ -120,30 +118,31 @@ public class CPPASTDeleteExpression extends ASTNode implements ICPPASTDeleteExpr
|
||||||
return implicitNames;
|
return implicitNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@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(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( operand != null ) if( !operand.accept( action ) ) return false;
|
if (operand != null && !operand.accept(action))
|
||||||
|
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;
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
|
||||||
copy.setIsNewTypeId(isNewTypeId);
|
copy.setIsNewTypeId(isNewTypeId);
|
||||||
if (placement != null) {
|
if (placement != null) {
|
||||||
IASTInitializerClause[] plcmt = new IASTInitializerClause[placement.length];
|
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();
|
plcmt[i]= placement[i].copy();
|
||||||
}
|
}
|
||||||
copy.setPlacementArguments(plcmt);
|
copy.setPlacementArguments(plcmt);
|
||||||
|
@ -133,13 +133,15 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
|
||||||
isNewTypeId = value;
|
isNewTypeId = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner#getImplicitNames()
|
||||||
|
*/
|
||||||
public IASTImplicitName[] getImplicitNames() {
|
public IASTImplicitName[] getImplicitNames() {
|
||||||
if(implicitNames == null) {
|
if (implicitNames == null) {
|
||||||
ICPPFunction operatorFunction = CPPSemantics.findOverloadedOperator(this);
|
ICPPFunction operatorFunction = CPPSemantics.findOverloadedOperator(this);
|
||||||
if(operatorFunction == null) {
|
if (operatorFunction == null) {
|
||||||
implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
CPPASTImplicitName operatorName = new CPPASTImplicitName(operatorFunction.getNameCharArray(), this);
|
CPPASTImplicitName operatorName = new CPPASTImplicitName(operatorFunction.getNameCharArray(), this);
|
||||||
operatorName.setOperator(true);
|
operatorName.setOperator(true);
|
||||||
operatorName.setBinding(operatorFunction);
|
operatorName.setBinding(operatorFunction);
|
||||||
|
@ -151,7 +153,6 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
|
||||||
return implicitNames;
|
return implicitNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this expression is allocating an array.
|
* Returns true if this expression is allocating an array.
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
|
@ -163,18 +164,18 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
|
||||||
|
|
||||||
|
|
||||||
@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(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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,11 +191,11 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
|
||||||
if (initializer != null && !initializer.accept(action))
|
if (initializer != null && !initializer.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;
|
||||||
|
|
|
@ -94,18 +94,22 @@ public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpres
|
||||||
return op == op_postFixDecr || op == op_postFixIncr;
|
return op == op_postFixDecr || op == op_postFixIncr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner#getImplicitNames()
|
||||||
|
*/
|
||||||
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;
|
implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
|
||||||
|
} else {
|
||||||
CPPASTImplicitName operatorName = new CPPASTImplicitName(overload.getNameCharArray(), this);
|
CPPASTImplicitName operatorName = new CPPASTImplicitName(overload.getNameCharArray(), this);
|
||||||
operatorName.setOperator(true);
|
operatorName.setOperator(true);
|
||||||
operatorName.setBinding(overload);
|
operatorName.setBinding(overload);
|
||||||
operatorName.computeOperatorOffsets(operand, isPostfixOperator());
|
operatorName.computeOperatorOffsets(operand, isPostfixOperator());
|
||||||
implicitNames = new IASTImplicitName[] { operatorName };
|
implicitNames = new IASTImplicitName[] { operatorName };
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return implicitNames;
|
return implicitNames;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +120,7 @@ public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpres
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +138,8 @@ public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpres
|
||||||
|
|
||||||
if (isPostfix && action.shouldVisitImplicitNames) {
|
if (isPostfix && 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