Author: martin
Date: 2005-04-30 03:54:19 -0400 (Sat, 30 Apr 2005)
New Revision: 43818

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


Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog    2005-04-30 07:54:00 UTC (rev 43817)
+++ trunk/mcs/gmcs/ChangeLog    2005-04-30 07:54:19 UTC (rev 43818)
@@ -1,3 +1,12 @@
+2005-04-27  Marek Safar  <[EMAIL PROTECTED]>
+
+       Fix #74378
+       * class.cs (EmitFieldInitializers): Use FieldExpr in initializer.
+       
+       * ecore.cs (FieldExpr): Add a new ctor with in_initializer.
+       (FieldExpr.DoResolve): Obsolete members are ignored for field
+       initializers.
+       
 2005-04-26  Marek Safar  <[EMAIL PROTECTED]>
 
        * attribute.cs (AreOverloadedMethodParamsClsCompliant): Add array

Modified: trunk/mcs/gmcs/class.cs
===================================================================
--- trunk/mcs/gmcs/class.cs     2005-04-30 07:54:00 UTC (rev 43817)
+++ trunk/mcs/gmcs/class.cs     2005-04-30 07:54:19 UTC (rev 43818)
@@ -876,7 +876,7 @@
                                        return false;
 
                                Location l = f.Location;
-                               FieldExpr fe = new FieldExpr (f.FieldBuilder, 
l);
+                               FieldExpr fe = new FieldExpr (f.FieldBuilder, 
l, true);
                                fe.InstanceExpression = instance_expr;
 
                                ExpressionStatement a = new Assign (fe, e, l);

Modified: trunk/mcs/gmcs/ecore.cs
===================================================================
--- trunk/mcs/gmcs/ecore.cs     2005-04-30 07:54:00 UTC (rev 43817)
+++ trunk/mcs/gmcs/ecore.cs     2005-04-30 07:54:19 UTC (rev 43818)
@@ -2921,7 +2921,13 @@
                
                LocalTemporary temp;
                bool prepared;
-               bool is_field_initializer;
+               bool in_initializer;
+
+               public FieldExpr (FieldInfo fi, Location l, bool 
in_initializer):
+                       this (fi, l)
+               {
+                       this.in_initializer = in_initializer;
+               }
                
                public FieldExpr (FieldInfo fi, Location l)
                {
@@ -3092,17 +3098,19 @@
                                        return null;
                        }
 
-                       ObsoleteAttribute oa;
-                       FieldBase f = TypeManager.GetField (FieldInfo);
-                       if (f != null) {
-                               oa = f.GetObsoleteAttribute (f.Parent);
-                               if (oa != null)
-                                       AttributeTester.Report_ObsoleteMessage 
(oa, f.GetSignatureForError (), loc);
-                               // To be sure that type is external because we 
do not register generated fields
-                        } else if (!(FieldInfo.DeclaringType is TypeBuilder)) 
{                                
-                               oa = AttributeTester.GetMemberObsoleteAttribute 
(FieldInfo);
-                               if (oa != null)
-                                       AttributeTester.Report_ObsoleteMessage 
(oa, TypeManager.GetFullNameSignature (FieldInfo), loc);
+                       if (!in_initializer) {
+                               ObsoleteAttribute oa;
+                               FieldBase f = TypeManager.GetField (FieldInfo);
+                               if (f != null) {
+                                       oa = f.GetObsoleteAttribute (f.Parent);
+                                       if (oa != null)
+                                               
AttributeTester.Report_ObsoleteMessage (oa, f.GetSignatureForError (), loc);
+                                       // To be sure that type is external 
because we do not register generated fields
+                               } else if (!(FieldInfo.DeclaringType is 
TypeBuilder)) {                                
+                                       oa = 
AttributeTester.GetMemberObsoleteAttribute (FieldInfo);
+                                       if (oa != null)
+                                               
AttributeTester.Report_ObsoleteMessage (oa, TypeManager.GetFullNameSignature 
(FieldInfo), loc);
+                               }
                        }
 
                        if (ec.CurrentAnonymousMethod != null){
@@ -3175,8 +3183,7 @@
                                        Report_AssignToReadonly (false);
 
                                Type ctype;
-                               if (!is_field_initializer &&
-                                   (ec.TypeContainer.CurrentType != null))
+                               if (ec.TypeContainer.CurrentType != null)
                                        ctype = ec.TypeContainer.CurrentType;
                                else
                                        ctype = ec.ContainerType;

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

Reply via email to