Author: martin
Date: 2005-04-15 04:54:26 -0400 (Fri, 15 Apr 2005)
New Revision: 43033

Modified:
   trunk/mcs/gmcs/ChangeLog
   trunk/mcs/gmcs/ecore.cs
Log:
**** Merged r41506 from MCS ****


Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog    2005-04-15 08:54:04 UTC (rev 43032)
+++ trunk/mcs/gmcs/ChangeLog    2005-04-15 08:54:26 UTC (rev 43033)
@@ -1,3 +1,11 @@
+2005-03-07  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       Fix #73394.
+       * ecore.cs (FieldExpr.EmitInstance): Catch cases of CS0120 that
+       slipped in because of variable names that are identical to a
+       builtin type's BCL equivalent ('string String;', 'int Int32;').
+       (PropertyExpr.EmitInstance): Likewise.
+
 2005-03-04  Marek Safar  <[EMAIL PROTECTED]>
 
        * cs-tokenizer.cs (PreProcessPragma): Add warning 1633, 1635.

Modified: trunk/mcs/gmcs/ecore.cs
===================================================================
--- trunk/mcs/gmcs/ecore.cs     2005-04-15 08:54:04 UTC (rev 43032)
+++ trunk/mcs/gmcs/ecore.cs     2005-04-15 08:54:26 UTC (rev 43033)
@@ -3212,6 +3212,16 @@
 
                void EmitInstance (EmitContext ec)
                {
+                       //
+                       // In case it escapes StaticMemberCheck due to 
IdenticalTypeAndName.
+                       // This happens in cases like 'string String', 'int 
Int32', etc.
+                       // where the "IdenticalTypeAndName" mechanism is fooled.
+                       //
+                       if (instance_expr == null) {
+                               SimpleName.Error_ObjectRefRequired (ec, loc, 
FieldInfo.Name);
+                               return;
+                       }
+
                        if (instance_expr.Type.IsValueType) {
                                if (instance_expr is IMemoryLocation) {
                                        ((IMemoryLocation) 
instance_expr).AddressOf (ec, AddressOp.LoadStore);
@@ -3591,6 +3601,16 @@
                        if (is_static)
                                return;
 
+                       //
+                       // In case it escapes StaticMemberCheck due to 
IdenticalTypeAndName.
+                       // This happens in cases like 'string String', 'int 
Int32', etc.
+                       // where the "IdenticalTypeAndName" mechanism is fooled.
+                       //
+                       if (instance_expr == null) {
+                               SimpleName.Error_ObjectRefRequired (ec, loc, 
PropertyInfo.Name);
+                               return;
+                       }
+
                        if (instance_expr.Type.IsValueType) {
                                if (instance_expr is IMemoryLocation) {
                                        ((IMemoryLocation) 
instance_expr).AddressOf (ec, AddressOp.LoadStore);

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

Reply via email to