1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Cosmetics.

Change-Id: I8e759d90c01ce865a14c6a57d91e4c9e9b2bc47f
This commit is contained in:
Sergey Prigogin 2015-04-03 14:00:49 -07:00
parent 55475a9fea
commit 0745c0a502
2 changed files with 40 additions and 35 deletions

View file

@ -396,7 +396,7 @@ public abstract class ASTNode implements IASTNode {
}
/**
* If ambiguity resolution is in progress, and procesing of this node has been deferred,
* If ambiguity resolution is in progress, and processing of this node has been deferred,
* process it now. Has no effect if ambiguity resolution is not in progress.
*/
public void resolvePendingAmbiguities() {

View file

@ -18,6 +18,7 @@ import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorNameOwner;
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
@ -35,18 +36,18 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpression, IASTAmbiguityParent {
private int op;
private ICPPASTExpression operand1;
private ICPPASTInitializerClause operand2;
private int fOperator;
private ICPPASTExpression fOperand1;
private ICPPASTInitializerClause fOperand2;
private ICPPEvaluation evaluation;
private IASTImplicitName[] implicitNames;
private ICPPEvaluation fEvaluation;
private IASTImplicitName[] fImplicitNames;
public CPPASTBinaryExpression() {
}
public CPPASTBinaryExpression(int op, IASTExpression operand1, IASTInitializerClause operand2) {
this.op = op;
this.fOperator = op;
setOperand1(operand1);
setInitOperand2(operand2);
}
@ -58,38 +59,38 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
@Override
public CPPASTBinaryExpression copy(CopyStyle style) {
CPPASTBinaryExpression copy = new CPPASTBinaryExpression(op,
operand1 == null ? null : operand1.copy(style),
operand2 == null ? null : operand2.copy(style));
CPPASTBinaryExpression copy = new CPPASTBinaryExpression(fOperator,
fOperand1 == null ? null : fOperand1.copy(style),
fOperand2 == null ? null : fOperand2.copy(style));
return copy(copy, style);
}
@Override
public int getOperator() {
return op;
return fOperator;
}
@Override
public IASTExpression getOperand1() {
return operand1;
return fOperand1;
}
@Override
public IASTInitializerClause getInitOperand2() {
return operand2;
return fOperand2;
}
@Override
public IASTExpression getOperand2() {
if (operand2 instanceof IASTExpression)
return (IASTExpression) operand2;
if (fOperand2 instanceof IASTExpression)
return (IASTExpression) fOperand2;
return null;
}
@Override
public void setOperator(int op) {
assertNotFrozen();
this.op = op;
this.fOperator = op;
}
@Override
@ -102,7 +103,7 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
expression.setParent(this);
expression.setPropertyInParent(OPERAND_ONE);
}
operand1 = (ICPPASTExpression) expression;
fOperand1 = (ICPPASTExpression) expression;
}
public void setInitOperand2(IASTInitializerClause operand) {
@ -113,7 +114,7 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
operand.setParent(this);
operand.setPropertyInParent(OPERAND_TWO);
}
operand2 = (ICPPASTInitializerClause) operand;
fOperand2 = (ICPPASTInitializerClause) operand;
}
@Override
@ -123,25 +124,25 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
@Override
public IASTImplicitName[] getImplicitNames() {
if (implicitNames == null) {
if (fImplicitNames == null) {
ICPPFunction overload = getOverload();
if (overload == null || (overload instanceof CPPImplicitFunction && !(overload instanceof ICPPMethod))) {
implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
fImplicitNames = 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 };
operatorName.computeOperatorOffsets(fOperand1, true);
fImplicitNames = new IASTImplicitName[] { operatorName };
}
}
return implicitNames;
return fImplicitNames;
}
@Override
public boolean accept(ASTVisitor action) {
if (operand1 instanceof IASTBinaryExpression || operand2 instanceof IASTBinaryExpression) {
if (fOperand1 instanceof IASTBinaryExpression || fOperand2 instanceof IASTBinaryExpression) {
return acceptWithoutRecursion(this, action);
}
@ -153,13 +154,13 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
}
}
if (operand1 != null && !operand1.accept(action))
if (fOperand1 != null && !fOperand1.accept(action))
return false;
if (action.shouldVisitImplicitNames && !acceptByNodes(getImplicitNames(), action))
return false;
if (operand2 != null && !operand2.accept(action))
if (fOperand2 != null && !fOperand2.accept(action))
return false;
if (action.shouldVisitExpressions && action.leave(this) == ASTVisitor.PROCESS_ABORT)
@ -219,6 +220,10 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
}
if (op2 != null && !op2.accept(action))
return false;
if (action.shouldVisitImplicitDestructorNames &&
!acceptByNodes(((IASTImplicitDestructorNameOwner) expr).getImplicitDestructorNames(), action)) {
return false;
}
}
if (action.shouldVisitExpressions && action.leave(expr) == ASTVisitor.PROCESS_ABORT)
@ -232,15 +237,15 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
@Override
public void replace(IASTNode child, IASTNode other) {
if (child == operand1) {
if (child == fOperand1) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
operand1 = (ICPPASTExpression) other;
fOperand1 = (ICPPASTExpression) other;
}
if (child == operand2) {
if (child == fOperand2) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
operand2 = (ICPPASTInitializerClause) other;
fOperand2 = (ICPPASTInitializerClause) other;
}
}
@ -255,17 +260,17 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
@Override
public ICPPEvaluation getEvaluation() {
if (evaluation == null)
evaluation= computeEvaluation();
if (fEvaluation == null)
fEvaluation= computeEvaluation();
return evaluation;
return fEvaluation;
}
private ICPPEvaluation computeEvaluation() {
if (operand1 == null || operand2 == null)
if (fOperand1 == null || fOperand2 == null)
return EvalFixed.INCOMPLETE;
return new EvalBinary(op, operand1.getEvaluation(), operand2.getEvaluation(), this);
return new EvalBinary(fOperator, fOperand1.getEvaluation(), fOperand2.getEvaluation(), this);
}
@Override