* HashSet.cs (Enumerator.IEnumerator.Reset): Check invariants.
authorRaja R Harinath <harinath@hurrynot.org>
Thu, 30 Jul 2009 18:03:20 +0000 (18:03 -0000)
committerRaja R Harinath <harinath@hurrynot.org>
Thu, 30 Jul 2009 18:03:20 +0000 (18:03 -0000)
svn path=/trunk/mcs/; revision=139107

mcs/class/System.Core/System.Collections.Generic/ChangeLog
mcs/class/System.Core/System.Collections.Generic/HashSet.cs

index 30b9928386d92cfcbe79ef1367fdb7b0ae072a7e..79d1c0588033ab593511f24f8353f53824537e7e 100644 (file)
@@ -1,3 +1,9 @@
+2009-07-30  Raja R Harinath  <harinath@hurrynot.org>
+
+       * HashSet.cs (Enumerator.CheckCurrent): Inline into ...
+       (Enumerator.IEnumerator.Current): ... this.
+       (Enumerator.IEnumerator.Reset): Check invariants.
+
 2009-07-30  Raja R Harinath  <harinath@hurrynot.org>
 
        * HashSet.cs (Enumerator.next): Rename from Enumerator.current and
index 56fc575c1837542cc39ec54974c6bcbb2c65c383..91c5a5c15f1c845e2cd0a0e19264c1e11413659c 100644 (file)
@@ -612,13 +612,16 @@ namespace System.Collections.Generic {
 
                        object IEnumerator.Current {
                                get {
-                                       CheckCurrent ();
+                                       CheckState ();
+                                       if (next <= 0)
+                                               throw new InvalidOperationException ("Current is not valid");
                                        return current;
                                }
                        }
 
                        void IEnumerator.Reset ()
                        {
+                               CheckState ();
                                next = 0;
                        }
 
@@ -634,14 +637,6 @@ namespace System.Collections.Generic {
                                if (hashset.generation != stamp)
                                        throw new InvalidOperationException ("HashSet have been modified while it was iterated over");
                        }
-
-                       void CheckCurrent ()
-                       {
-                               CheckState ();
-
-                               if (next <= 0)
-                                       throw new InvalidOperationException ("Current is not valid");
-                       }
                }
 
                // borrowed from System.Collections.HashTable