1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 16:56:04 +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. * process it now. Has no effect if ambiguity resolution is not in progress.
*/ */
public void resolvePendingAmbiguities() { 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.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression; import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpression; 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.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner; import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause; 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 { public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpression, IASTAmbiguityParent {
private int op; private int fOperator;
private ICPPASTExpression operand1; private ICPPASTExpression fOperand1;
private ICPPASTInitializerClause operand2; private ICPPASTInitializerClause fOperand2;
private ICPPEvaluation evaluation; private ICPPEvaluation fEvaluation;
private IASTImplicitName[] implicitNames; private IASTImplicitName[] fImplicitNames;
public CPPASTBinaryExpression() { public CPPASTBinaryExpression() {
} }
public CPPASTBinaryExpression(int op, IASTExpression operand1, IASTInitializerClause operand2) { public CPPASTBinaryExpression(int op, IASTExpression operand1, IASTInitializerClause operand2) {
this.op = op; this.fOperator = op;
setOperand1(operand1); setOperand1(operand1);
setInitOperand2(operand2); setInitOperand2(operand2);
} }
@ -58,38 +59,38 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
@Override @Override
public CPPASTBinaryExpression copy(CopyStyle style) { public CPPASTBinaryExpression copy(CopyStyle style) {
CPPASTBinaryExpression copy = new CPPASTBinaryExpression(op, CPPASTBinaryExpression copy = new CPPASTBinaryExpression(fOperator,
operand1 == null ? null : operand1.copy(style), fOperand1 == null ? null : fOperand1.copy(style),
operand2 == null ? null : operand2.copy(style)); fOperand2 == null ? null : fOperand2.copy(style));
return copy(copy, style); return copy(copy, style);
} }
@Override @Override
public int getOperator() { public int getOperator() {
return op; return fOperator;
} }
@Override @Override
public IASTExpression getOperand1() { public IASTExpression getOperand1() {
return operand1; return fOperand1;
} }
@Override @Override
public IASTInitializerClause getInitOperand2() { public IASTInitializerClause getInitOperand2() {
return operand2; return fOperand2;
} }
@Override @Override
public IASTExpression getOperand2() { public IASTExpression getOperand2() {
if (operand2 instanceof IASTExpression) if (fOperand2 instanceof IASTExpression)
return (IASTExpression) operand2; return (IASTExpression) fOperand2;
return null; return null;
} }
@Override @Override
public void setOperator(int op) { public void setOperator(int op) {
assertNotFrozen(); assertNotFrozen();
this.op = op; this.fOperator = op;
} }
@Override @Override
@ -102,7 +103,7 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
expression.setParent(this); expression.setParent(this);
expression.setPropertyInParent(OPERAND_ONE); expression.setPropertyInParent(OPERAND_ONE);
} }
operand1 = (ICPPASTExpression) expression; fOperand1 = (ICPPASTExpression) expression;
} }
public void setInitOperand2(IASTInitializerClause operand) { public void setInitOperand2(IASTInitializerClause operand) {
@ -113,7 +114,7 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
operand.setParent(this); operand.setParent(this);
operand.setPropertyInParent(OPERAND_TWO); operand.setPropertyInParent(OPERAND_TWO);
} }
operand2 = (ICPPASTInitializerClause) operand; fOperand2 = (ICPPASTInitializerClause) operand;
} }
@Override @Override
@ -123,25 +124,25 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
@Override @Override
public IASTImplicitName[] getImplicitNames() { public IASTImplicitName[] getImplicitNames() {
if (implicitNames == null) { if (fImplicitNames == null) {
ICPPFunction overload = getOverload(); ICPPFunction overload = getOverload();
if (overload == null || (overload instanceof CPPImplicitFunction && !(overload instanceof ICPPMethod))) { if (overload == null || (overload instanceof CPPImplicitFunction && !(overload instanceof ICPPMethod))) {
implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; fImplicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
} else { } 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(fOperand1, true);
implicitNames = new IASTImplicitName[] { operatorName }; fImplicitNames = new IASTImplicitName[] { operatorName };
} }
} }
return implicitNames; return fImplicitNames;
} }
@Override @Override
public boolean accept(ASTVisitor action) { public boolean accept(ASTVisitor action) {
if (operand1 instanceof IASTBinaryExpression || operand2 instanceof IASTBinaryExpression) { if (fOperand1 instanceof IASTBinaryExpression || fOperand2 instanceof IASTBinaryExpression) {
return acceptWithoutRecursion(this, action); 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; return false;
if (action.shouldVisitImplicitNames && !acceptByNodes(getImplicitNames(), action)) if (action.shouldVisitImplicitNames && !acceptByNodes(getImplicitNames(), action))
return false; return false;
if (operand2 != null && !operand2.accept(action)) if (fOperand2 != null && !fOperand2.accept(action))
return false; return false;
if (action.shouldVisitExpressions && action.leave(this) == ASTVisitor.PROCESS_ABORT) 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)) if (op2 != null && !op2.accept(action))
return false; return false;
if (action.shouldVisitImplicitDestructorNames &&
!acceptByNodes(((IASTImplicitDestructorNameOwner) expr).getImplicitDestructorNames(), action)) {
return false;
}
} }
if (action.shouldVisitExpressions && action.leave(expr) == ASTVisitor.PROCESS_ABORT) if (action.shouldVisitExpressions && action.leave(expr) == ASTVisitor.PROCESS_ABORT)
@ -232,15 +237,15 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
@Override @Override
public void replace(IASTNode child, IASTNode other) { public void replace(IASTNode child, IASTNode other) {
if (child == operand1) { if (child == fOperand1) {
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent()); other.setParent(child.getParent());
operand1 = (ICPPASTExpression) other; fOperand1 = (ICPPASTExpression) other;
} }
if (child == operand2) { if (child == fOperand2) {
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent()); other.setParent(child.getParent());
operand2 = (ICPPASTInitializerClause) other; fOperand2 = (ICPPASTInitializerClause) other;
} }
} }
@ -255,17 +260,17 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
@Override @Override
public ICPPEvaluation getEvaluation() { public ICPPEvaluation getEvaluation() {
if (evaluation == null) if (fEvaluation == null)
evaluation= computeEvaluation(); fEvaluation= computeEvaluation();
return evaluation; return fEvaluation;
} }
private ICPPEvaluation computeEvaluation() { private ICPPEvaluation computeEvaluation() {
if (operand1 == null || operand2 == null) if (fOperand1 == null || fOperand2 == null)
return EvalFixed.INCOMPLETE; return EvalFixed.INCOMPLETE;
return new EvalBinary(op, operand1.getEvaluation(), operand2.getEvaluation(), this); return new EvalBinary(fOperator, fOperand1.getEvaluation(), fOperand2.getEvaluation(), this);
} }
@Override @Override