Author: raja
Date: 2005-07-06 04:44:00 -0400 (Wed, 06 Jul 2005)
New Revision: 46986

Modified:
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/ecore.cs
   trunk/mcs/mcs/expression.cs
Log:
Fix #75472.
* ecore.cs (SimpleName.GetSignatureForError): Add.
* expression.cs (MemberAccess.DoResolve): Don't clobber 'expr' field.
(MemberAccess.GetSignatureForError): Add.


Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2005-07-06 04:56:54 UTC (rev 46985)
+++ trunk/mcs/mcs/ChangeLog     2005-07-06 08:44:00 UTC (rev 46986)
@@ -1,3 +1,10 @@
+2005-07-06  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       Fix #75472.
+       * ecore.cs (SimpleName.GetSignatureForError): Add.
+       * expression.cs (MemberAccess.DoResolve): Don't clobber 'expr' field.
+       (MemberAccess.GetSignatureForError): Add.
+
 2005-07-05  Marek Safar  <[EMAIL PROTECTED]>
  
        The big error and warning messages review.

Modified: trunk/mcs/mcs/ecore.cs
===================================================================
--- trunk/mcs/mcs/ecore.cs      2005-07-06 04:56:54 UTC (rev 46985)
+++ trunk/mcs/mcs/ecore.cs      2005-07-06 08:44:00 UTC (rev 46986)
@@ -2270,6 +2270,11 @@
                {
                        return Name;
                }
+
+               public override string GetSignatureForError ()
+               {
+                       return Name;
+               }
        }
 
        /// <summary>
@@ -2923,7 +2928,7 @@
                                        
                                        return new EnumConstant (c, decl_type);
                                }
-                               
+
                                Expression exp = Constantify (o, t);
                                
                                if (!left_is_type) {

Modified: trunk/mcs/mcs/expression.cs
===================================================================
--- trunk/mcs/mcs/expression.cs 2005-07-06 04:56:54 UTC (rev 46985)
+++ trunk/mcs/mcs/expression.cs 2005-07-06 08:44:00 UTC (rev 46986)
@@ -7187,9 +7187,7 @@
                }
 
                public Expression Expr {
-                       get {
-                               return expr;
-                       }
+                       get { return expr; }
                }
 
                Expression DoResolve (EmitContext ec, Expression right_side)
@@ -7205,21 +7203,22 @@
                        //
 
                        SimpleName original = expr as SimpleName;
-                       expr = expr.Resolve (ec, ResolveFlags.VariableOrValue | 
ResolveFlags.Type |
+                       Expression new_expr = expr.Resolve (ec,
+                               ResolveFlags.VariableOrValue | 
ResolveFlags.Type |
                                ResolveFlags.Intermediate | 
ResolveFlags.DisableFlowAnalysis);
 
-                       if (expr == null)
+                       if (new_expr == null)
                                return null;
 
-                       if (expr is Namespace) {
-                               Namespace ns = (Namespace) expr;
+                       if (new_expr is Namespace) {
+                               Namespace ns = (Namespace) new_expr;
                                FullNamedExpression retval = ns.Lookup 
(ec.DeclSpace, Identifier, loc);
                                if (retval == null)
                                        Report.Error (234, loc, "The type or 
namespace name `{0}' does not exist in the namespace `{1}'. Are you missing an 
assembly reference?",
                                                Identifier, ns.FullName);
                                return retval;
                        }
-                                       
+
                        //
                        // TODO: I mailed Ravi about this, and apparently we 
can get rid
                        // of this and put it in the right place.
@@ -7229,8 +7228,8 @@
                        // it will fail to find any members at all
                        //
 
-                       Type expr_type = expr.Type;
-                       if (expr is TypeExpr){
+                       Type expr_type = new_expr.Type;
+                       if (new_expr is TypeExpr){
                                if (!ec.DeclSpace.CheckAccessLevel (expr_type)){
                                        ErrorIsInaccesible (loc, 
TypeManager.CSharpName (expr_type));
                                        return null;
@@ -7241,7 +7240,6 @@
 
                                        if (en != null) {
                                                object value = 
en.LookupEnumValue (Identifier, loc);
-                                               
                                                if (value != null){
                                                        MemberCore mc = 
en.GetDefinition (Identifier);
                                                        ObsoleteAttribute oa = 
mc.GetObsoleteAttribute (en);
@@ -7268,7 +7266,7 @@
                                        }
                                }
                        }
-                       
+
                        if (expr_type.IsPointer){
                                Error (23, "The `.' operator can not be applied 
to pointer operands (" +
                                       TypeManager.CSharpName (expr_type) + 
")");
@@ -7281,8 +7279,8 @@
                                return null;
 
                        if (member_lookup is TypeExpr) {
-                               if (!(expr is TypeExpr) && 
-                                   (original == null || 
!original.IdenticalNameAndTypeName (ec, expr, loc))) {
+                               if (!(new_expr is TypeExpr) && 
+                                   (original == null || 
!original.IdenticalNameAndTypeName (ec, new_expr, loc))) {
                                        Report.Error (572, loc, "`{0}': cannot 
reference a type through an expression; try `{1}' instead",
                                                Identifier, 
member_lookup.GetSignatureForError ());
                                        return null;
@@ -7292,7 +7290,7 @@
                        }
 
                        MemberExpr me = (MemberExpr) member_lookup;
-                       member_lookup = me.ResolveMemberAccess (ec, expr, loc, 
original);
+                       member_lookup = me.ResolveMemberAccess (ec, new_expr, 
loc, original);
                        if (member_lookup == null)
                                return null;
 
@@ -7376,6 +7374,11 @@
                {
                        return expr + "." + Identifier;
                }
+
+               public override string GetSignatureForError ()
+               {
+                       return expr.GetSignatureForError () + "." + Identifier;
+               }
        }
 
        /// <summary>

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to