Skip to content

Commit c884022

Browse files
thomasmulvaneyswannodette
authored andcommitted
CLJS-1765: Empty iterator for hash maps with nil key
1 parent a8fb504 commit c884022

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/main/cljs/cljs/core.cljs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7115,12 +7115,12 @@ reduces them without incurring seq initialization"
71157115
(deftype HashMapIter [nil-val root-iter ^:mutable seen]
71167116
Object
71177117
(hasNext [_]
7118-
(and ^boolean seen ^boolean (.hasNext root-iter)))
7118+
(or (not seen) ^boolean (.hasNext root-iter)))
71197119
(next [_]
71207120
(if-not ^boolean seen
71217121
(do
71227122
(set! seen true)
7123-
nil-val)
7123+
[nil nil-val])
71247124
(.next root-iter)))
71257125
(remove [_] (js/Error. "Unsupported operation")))
71267126

@@ -7151,7 +7151,7 @@ reduces them without incurring seq initialization"
71517151

71527152
IIterable
71537153
(-iterator [coll]
7154-
(let [root-iter (if ^boolean root (-iterator root) nil-iter)]
7154+
(let [root-iter (if ^boolean root (-iterator root) (nil-iter))]
71557155
(if has-nil?
71567156
(HashMapIter. nil-val root-iter false)
71577157
root-iter)))

0 commit comments

Comments
 (0)