Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Kucera2009-03-20 15:24:45 +0000
committerMike Kucera2009-03-20 15:24:45 +0000
commit6045ee44784e5a4e924170e78457cacfcb2e3765 (patch)
treeca018d6ecef4d2f0d63a7b569c6c21910b299334 /core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java
parent2d935d7b6e6afb6827a206b7fa12b8fd0e50a717 (diff)
downloadorg.eclipse.cdt-6045ee44784e5a4e924170e78457cacfcb2e3765.tar.gz
org.eclipse.cdt-6045ee44784e5a4e924170e78457cacfcb2e3765.tar.xz
org.eclipse.cdt-6045ee44784e5a4e924170e78457cacfcb2e3765.zip
Fixes bugs 269365, 268534, and 266211. Fixed overload resolution for operator functions and also fixed expression lists.
Diffstat (limited to 'core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java35
1 files changed, 1 insertions, 34 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java
index c51e907bf4c..c20b1eeb3a1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java
@@ -17,13 +17,11 @@ import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
-import org.eclipse.cdt.core.dom.ast.IEnumeration;
import org.eclipse.cdt.core.dom.ast.IPointerType;
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
@@ -171,35 +169,9 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
if (overload != UNINITIALIZED)
return overload;
- return overload= computeOverload();
+ return overload = CPPSemantics.findOverloadedOperator(this);
}
- private ICPPFunction computeOverload() {
- IType type1 = getOperand1().getExpressionType();
- IType ultimateType1 = SemanticUtil.getUltimateTypeUptoPointers(type1);
- if (ultimateType1 instanceof IProblemBinding) {
- return null;
- }
- if (ultimateType1 instanceof ICPPClassType) {
- ICPPFunction operator = CPPSemantics.findOperator(this, (ICPPClassType) ultimateType1);
- if (operator != null)
- return operator;
- }
-
- // try to find a function
- if(op != op_assign) {
- IType type2 = getOperand2().getExpressionType();
- IType ultimateType2 = SemanticUtil.getUltimateTypeUptoPointers(type2);
- if (ultimateType2 instanceof IProblemBinding)
- return null;
- if (isUserDefined(ultimateType1) || isUserDefined(ultimateType2))
- return CPPSemantics.findOverloadedOperator(this);
- }
- return null;
- }
-
-
-
private IType createExpressionType() {
// Check for overloaded operator.
ICPPFunction o= getOverload();
@@ -262,10 +234,5 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
}
return type1;
}
-
-
- private static boolean isUserDefined(IType type) {
- return type instanceof ICPPClassType || type instanceof IEnumeration;
- }
}

Back to the top