Author: martin
Date: 2005-04-12 13:46:45 -0400 (Tue, 12 Apr 2005)
New Revision: 42845
Modified:
trunk/mcs/gmcs/ChangeLog
trunk/mcs/gmcs/expression.cs
Log:
**** Merged r40750 from MCS ****
Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog 2005-04-12 17:21:43 UTC (rev 42844)
+++ trunk/mcs/gmcs/ChangeLog 2005-04-12 17:46:45 UTC (rev 42845)
@@ -1,3 +1,10 @@
+2005-02-16 Raja R Harinath <[EMAIL PROTECTED]>
+
+ Fix parts of #63202.
+ * expression.cs (UnaryMutator.ResolveOperator): Remove redundant
+ lookup of operator in base type. Ensure that all checks happen
+ when the operator resolves to an "op_..." method.
+
2005-02-15 Raja R Harinath <[EMAIL PROTECTED]>
Fix #71992.
Modified: trunk/mcs/gmcs/expression.cs
===================================================================
--- trunk/mcs/gmcs/expression.cs 2005-04-12 17:21:43 UTC (rev 42844)
+++ trunk/mcs/gmcs/expression.cs 2005-04-12 17:46:45 UTC (rev 42845)
@@ -854,16 +854,15 @@
mg = MemberLookup (ec, expr_type, op_name,
MemberTypes.Method, AllBindingFlags, loc);
- if (mg == null && expr_type.BaseType != null)
- mg = MemberLookup (ec, expr_type.BaseType,
op_name,
- MemberTypes.Method,
AllBindingFlags, loc);
-
if (mg != null) {
method = StaticCallExpr.MakeSimpleCall (
ec, (MethodGroupExpr) mg, expr, loc);
type = method.Type;
- return this;
+ } else if (!IsIncrementableNumber (expr_type)) {
+ Error (187, "No such operator '" + OperName
(mode) + "' defined for type '" +
+ TypeManager.CSharpName (expr_type) +
"'");
+ return null;
}
//
@@ -874,35 +873,20 @@
type = expr_type;
if (expr.eclass == ExprClass.Variable){
LocalVariableReference var = expr as
LocalVariableReference;
- if ((var != null) && var.IsReadOnly)
+ if ((var != null) && var.IsReadOnly) {
Error (1604, "cannot assign to `" +
var.Name + "' because it is readonly");
- if (IsIncrementableNumber (expr_type) ||
- expr_type == TypeManager.decimal_type){
- return this;
+ return null;
}
- } else if (expr.eclass == ExprClass.IndexerAccess){
- IndexerAccess ia = (IndexerAccess) expr;
-
- expr = ia.ResolveLValue (ec, this);
+ } else if (expr.eclass == ExprClass.IndexerAccess ||
expr.eclass == ExprClass.PropertyAccess){
+ expr = expr.ResolveLValue (ec, this);
if (expr == null)
return null;
-
- return this;
- } else if (expr.eclass == ExprClass.PropertyAccess){
- PropertyExpr pe = (PropertyExpr) expr;
-
- if (pe.VerifyAssignable ())
- return this;
-
- return null;
} else {
expr.Error_UnexpectedKind ("variable, indexer
or property access", loc);
return null;
}
- Error (187, "No such operator '" + OperName (mode) + "'
defined for type '" +
- TypeManager.CSharpName (expr_type) + "'");
- return null;
+ return this;
}
public override Expression DoResolve (EmitContext ec)
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches