[Mono-bugs] [Bug 74809][Maj] New - anonymous methods and iterators are not working

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 3 May 2005 12:14:01 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by martin@ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=74809

--- shadow/74809	2005-05-03 12:14:01.000000000 -0400
+++ shadow/74809.tmp.31762	2005-05-03 12:14:01.000000000 -0400
@@ -0,0 +1,50 @@
+Bug#: 74809
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: martin@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: anonymous methods and iterators are not working
+
+using System;
+using System.Collections;
+ 
+class X {
+        delegate void A ();
+ 
+        static IEnumerable GetIt (int [] args)
+        {
+                foreach (int arg in args) {
+                        Console.WriteLine ("OUT: {0}", arg);
+                        A a = delegate {
+                                Console.WriteLine ("arg: {0}", arg);
+                        };
+                        a ();
+                        yield return arg;
+                }
+        }
+ 
+        static int Main ()
+        {
+                int total = 0;
+                foreach (int i in GetIt (new int [] { 1, 2, 3})){
+                        Console.WriteLine ("Got: " + i);
+                        total += i;
+                }
+ 
+                if (total != 6)
+                        return 1;
+ 
+                return 0;
+        }
+}