Author: marek
Date: 2007-02-23 13:59:02 -0500 (Fri, 23 Feb 2007)
New Revision: 73375

Modified:
   trunk/mcs/gmcs/cs-parser.jay
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/class.cs
   trunk/mcs/mcs/cs-parser.jay
Log:
2007-02-23  Marek Safar  <[EMAIL PROTECTED]>

        A fix for bug #80878
        * class.cs, cs-parser.jay: Event property can host anonymous methods.


Modified: trunk/mcs/gmcs/cs-parser.jay
===================================================================
--- trunk/mcs/gmcs/cs-parser.jay        2007-02-23 17:02:33 UTC (rev 73374)
+++ trunk/mcs/gmcs/cs-parser.jay        2007-02-23 18:59:02 UTC (rev 73375)
@@ -2495,11 +2495,19 @@
                
                current_local_parameters = new Parameters (args);  
                lexer.EventParsing = false;
+               
+               anonymous_host = SimpleAnonymousHost.GetSimple ();
          }
           block
          {
-               $$ = new Accessor ((ToplevelBlock) $4, 0, (Attributes) $1, 
(Location) $2);
+               Accessor accessor = new Accessor ((ToplevelBlock) $4, 0, 
(Attributes) $1, (Location) $2);
                lexer.EventParsing = true;
+               
+               current_local_parameters = null;
+               SimpleAnonymousHost.Simple.Propagate (accessor);
+               anonymous_host = null;
+               
+               $$ = accessor;
          }
        | opt_attributes ADD error {
                Report.Error (73, (Location) $2, "An add or remove accessor 
must have a body");

Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2007-02-23 17:02:33 UTC (rev 73374)
+++ trunk/mcs/mcs/ChangeLog     2007-02-23 18:59:02 UTC (rev 73375)
@@ -1,3 +1,8 @@
+2007-02-23  Marek Safar  <[EMAIL PROTECTED]>
+
+       A fix for bug #80878
+       * class.cs, cs-parser.jay: Event property can host anonymous methods.
+
 2007-02-22  Marek Safar  <[EMAIL PROTECTED]>
 
        * attribute.cs: Enable ExtensionAttribute presence test.

Modified: trunk/mcs/mcs/class.cs
===================================================================
--- trunk/mcs/mcs/class.cs      2007-02-23 17:02:33 UTC (rev 73374)
+++ trunk/mcs/mcs/class.cs      2007-02-23 18:59:02 UTC (rev 73375)
@@ -1362,6 +1362,15 @@
                                }
                        }
 
+                       if (events != null) {
+                               foreach (Event e in events) {
+                                       if (!e.Add.ResolveMembers ())
+                                               return false;
+                                       if (!e.Remove.ResolveMembers ())
+                                               return false;
+                               }
+                       }
+
                        return true;
                }
 
@@ -6389,6 +6398,11 @@
                        }
                }
 
+               public virtual bool ResolveMembers ()
+               {
+                       return true;
+               }
+
                //
                //   Represents header string for documentation comment.
                //
@@ -6566,7 +6580,7 @@
                                return method.IsClsComplianceRequired ();
                        }
 
-                       public bool ResolveMembers ()
+                       public override bool ResolveMembers ()
                        {
                                if (yields) {
                                        iterator = Iterator.CreateIterator 
(this, Parent, null, ModFlags);
@@ -7114,9 +7128,12 @@
        public class EventProperty: Event {
                abstract class AEventPropertyAccessor : AEventAccessor
                {
+                       readonly ArrayList anonymous_methods;
+
                        public AEventPropertyAccessor (Event method, Accessor 
accessor, string prefix):
                                base (method, accessor, prefix)
                        {
+                               this.anonymous_methods = 
accessor.AnonymousMethods;
                        }
 
                        public override MethodBuilder Define (DeclSpace ds)
@@ -7124,6 +7141,20 @@
                                method.CheckAbstractAndExtern (block != null);
                                return base.Define (ds);
                        }
+
+                       public override bool ResolveMembers ()
+                       {
+                               if (anonymous_methods == null)
+                                       return true;
+
+                               foreach (AnonymousMethodExpression ame in 
anonymous_methods) {
+                                       if (!ame.CreateAnonymousHelpers ())
+                                               return false;
+                               }
+
+                               return true;
+                       }
+
                }
 
                sealed class AddDelegateMethod: AEventPropertyAccessor

Modified: trunk/mcs/mcs/cs-parser.jay
===================================================================
--- trunk/mcs/mcs/cs-parser.jay 2007-02-23 17:02:33 UTC (rev 73374)
+++ trunk/mcs/mcs/cs-parser.jay 2007-02-23 18:59:02 UTC (rev 73375)
@@ -2335,11 +2335,19 @@
                
                current_local_parameters = new Parameters (args);  
                lexer.EventParsing = false;
+               
+               anonymous_host = SimpleAnonymousHost.GetSimple ();
          }
-          block
+      block
          {
-               $$ = new Accessor ((ToplevelBlock) $4, 0, (Attributes) $1, 
(Location) $2);
+               Accessor accessor = new Accessor ((ToplevelBlock) $4, 0, 
(Attributes) $1, (Location) $2);
                lexer.EventParsing = true;
+               
+               current_local_parameters = null;
+               SimpleAnonymousHost.Simple.Propagate (accessor);
+               anonymous_host = null;
+               
+               $$ = accessor;
          }
        | opt_attributes ADD error {
                Report.Error (73, (Location) $2, "An add or remove accessor 
must have a body");

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

Reply via email to