Author: martin
Date: 2005-07-12 10:27:03 -0400 (Tue, 12 Jul 2005)
New Revision: 47214

Modified:
   trunk/mcs/gmcs/ChangeLog
   trunk/mcs/gmcs/assign.cs
   trunk/mcs/gmcs/ecore.cs
   trunk/mcs/gmcs/expression.cs
Log:
**** Merged r46986 from MCS ****


Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog    2005-07-12 14:17:22 UTC (rev 47213)
+++ trunk/mcs/gmcs/ChangeLog    2005-07-12 14:27:03 UTC (rev 47214)
@@ -15,6 +15,13 @@
 
        * generic.cs: Use MakeGenericType instead of BindGenericParameters.
 
+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/gmcs/assign.cs
===================================================================
--- trunk/mcs/gmcs/assign.cs    2005-07-12 14:17:22 UTC (rev 47213)
+++ trunk/mcs/gmcs/assign.cs    2005-07-12 14:27:03 UTC (rev 47214)
@@ -312,7 +312,10 @@
                        if (source is Assign)
                                source = embedded = ((Assign) 
source).GetEmbeddedAssign (loc);
 
+                       Report.Debug (64, "RESOLVE ASSIGN", this, target, 
source);
+
                        real_source = source = source.Resolve (ec);
+                       Report.Debug (64, "RESOLVE ASSIGN #1", this, target, 
source);
                        if (source == null) {
                                // Ensure that we don't propagate the error as 
spurious "uninitialized variable" errors.
                                target = target.ResolveLValue (ec, 
EmptyExpression.Null, Location);

Modified: trunk/mcs/gmcs/ecore.cs
===================================================================
--- trunk/mcs/gmcs/ecore.cs     2005-07-12 14:17:22 UTC (rev 47213)
+++ trunk/mcs/gmcs/ecore.cs     2005-07-12 14:27:03 UTC (rev 47214)
@@ -2433,6 +2433,11 @@
                {
                        return Name;
                }
+
+               public override string GetSignatureForError ()
+               {
+                       return Name;
+               }
        }
 
        /// <summary>
@@ -3188,7 +3193,7 @@
                                        
                                        return new EnumConstant (c, decl_type);
                                }
-                               
+
                                Expression exp = Constantify (o, t);
                                
                                if (!left_is_type) {

Modified: trunk/mcs/gmcs/expression.cs
===================================================================
--- trunk/mcs/gmcs/expression.cs        2005-07-12 14:17:22 UTC (rev 47213)
+++ trunk/mcs/gmcs/expression.cs        2005-07-12 14:27:03 UTC (rev 47214)
@@ -7358,8 +7358,8 @@
        /// </summary>
        public class MemberAccess : Expression {
                public string Identifier;
-               protected Expression expr;
-               protected TypeArguments args;
+               Expression expr;
+               TypeArguments args;
                
                public MemberAccess (Expression expr, string id, Location l)
                {
@@ -7376,9 +7376,7 @@
                }
 
                public Expression Expr {
-                       get {
-                               return expr;
-                       }
+                       get { return expr; }
                }
 
                Expression DoResolve (EmitContext ec, Expression right_side)
@@ -7394,14 +7392,15 @@
                        //
 
                        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;
                                string lookup_id = MemberName.MakeName 
(Identifier, args);
                                FullNamedExpression retval = ns.Lookup 
(ec.DeclSpace, lookup_id, loc);
                                if ((retval != null) && (args != null))
@@ -7411,7 +7410,7 @@
                                                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.
@@ -7421,10 +7420,8 @@
                        // it will fail to find any members at all
                        //
 
-                       Type expr_type;
-                       if (expr is TypeExpr){
-                               expr_type = expr.Type;
-
+                       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;
@@ -7435,7 +7432,6 @@
 
                                        if (en != null) {
                                                object value = 
en.LookupEnumValue (Identifier, loc);
-                                               
                                                if (value != null){
                                                        MemberCore mc = 
en.GetDefinition (Identifier);
                                                        ObsoleteAttribute oa = 
mc.GetObsoleteAttribute (en);
@@ -7461,9 +7457,8 @@
                                                }
                                        }
                                }
-                       } else
-                               expr_type = expr.Type;
-                       
+                       }
+
                        if (expr_type.IsPointer){
                                Error (23, "The `.' operator can not be applied 
to pointer operands (" +
                                       TypeManager.CSharpName (expr_type) + 
")");
@@ -7485,14 +7480,14 @@
                        }
 
                        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;
                                }
 
-                               ConstructedType ct = expr as ConstructedType;
+                               ConstructedType ct = new_expr as 
ConstructedType;
                                if (ct != null) {
                                        //
                                        // When looking up a nested type in a 
generic instance
@@ -7511,7 +7506,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;
 
@@ -7633,6 +7628,11 @@
                {
                        return expr + "." + MemberName.MakeName (Identifier, 
args);
                }
+
+               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