summary refs log tree commit diff stats
path: root/lib/pure/collections
diff options
context:
space:
mode:
authorCharles Blake <cblake@csail.mit.edu>2015-02-07 13:13:03 -0500
committerCharles Blake <cblake@csail.mit.edu>2015-02-07 13:13:03 -0500
commit1f3ce26421f73916aa978c67ab90cdf68218120d (patch)
tree0baf0c08299520adf6b47b6fbfc77c0977f07881 /lib/pure/collections
parent11e7c4960eefca0e4c081abe7b0eafbfa7af27b4 (diff)
downloadNim-1f3ce26421f73916aa978c67ab90cdf68218120d.tar.gz
Address Andreas' complaint about code duplication.
Diffstat (limited to 'lib/pure/collections')
-rw-r--r--lib/pure/collections/sets.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/pure/collections/sets.nim b/lib/pure/collections/sets.nim
index 3e462f73f..33fec1a18 100644
--- a/lib/pure/collections/sets.nim
+++ b/lib/pure/collections/sets.nim
@@ -246,8 +246,9 @@ proc incl*[A](s: var HashSet[A], other: HashSet[A]) =
   for item in other: incl(s, item)
 
 template doWhile(a: expr, b: stmt): stmt =
-  b
-  while a: b
+  while true:
+    b
+    if not a: break
 
 proc excl*[A](s: var HashSet[A], key: A) =
   ## Excludes `key` from the set `s`.