[svn] r6079: nemerle/trunk/ncc/generation/Typer3.n

malekith svnadmin at nemerle.org
Sat Jan 21 21:49:48 CET 2006


Log:
Make yielding function also work for non-generic IEnumerable.

Author: malekith
Date: Sat Jan 21 21:49:47 2006
New Revision: 6079

Modified:
   nemerle/trunk/ncc/generation/Typer3.n

Modified: nemerle/trunk/ncc/generation/Typer3.n
==============================================================================
--- nemerle/trunk/ncc/generation/Typer3.n	(original)
+++ nemerle/trunk/ncc/generation/Typer3.n	Sat Jan 21 21:49:47 2006
@@ -710,6 +710,7 @@
           System.Collections.IEnumerator,
           System.Collections.Generic.IEnumerator [$(yield_type : typed)],
           System.IDisposable,
+          System.Collections.IEnumerable,
           System.Collections.Generic.IEnumerable [$(yield_type : typed)]
         {
           public Current : $(yield_type : typed)
@@ -744,6 +745,17 @@
               this
           }
 
+          private NonGenericGetEnum () : System.Collections.IEnumerator 
+            implements System.Collections.IEnumerable.GetEnumerator
+          {
+            if ($interlocked_stuff) {
+              def res = $(name : name) () : this;
+              res.CopyFrom (this);
+              res
+            } else
+              this
+          }
+
           CopyFrom (other : this) : void
           {
             _N_this_used = 1;
@@ -879,7 +891,8 @@
           if (uses_yield)
             match (current_local_fun.ret_type.Fix ()) {
               | Class (tc, _) =>
-                tc.Equals (InternalType.Generic_IEnumerable_tc)
+                tc.Equals (InternalType.Generic_IEnumerable_tc) ||
+                tc.Equals (InternalType.IEnumerable_tc)
               | _ => Util.ice ()
             }
           else false;



More information about the svn mailing list