Skip to content

Commit 2b9ef28

Browse files
committed
Restore single pass over form children
This reverts to a scenario where parse-all does only a single pass over the children nodes. It does this by replacing a `doall` + `last` with just `last`. The `last` is new code as of the prior commit, so this switches back to a single pass over the children. It's not clear what the `doall` was doing. Perhaps it ensured that a file was fully parsed before closing, though I tried and failed to confirm that. In any case, the `last` should serve the same purpose.
1 parent ba3ea89 commit 2b9ef28

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/rewrite_clj/parser.cljc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@
2323
"Parse all forms from the given reader."
2424
[#?(:cljs ^not-native reader :default reader)]
2525
(let [nodes (->> (repeatedly #(parse reader))
26-
(take-while identity)
27-
(doall))]
28-
(with-meta
29-
(nforms/forms-node nodes)
30-
(merge (meta (first nodes))
31-
(select-keys (meta (last nodes)) [:end-row :end-col])))))
26+
(take-while identity))
27+
position-meta (merge (meta (first nodes))
28+
(select-keys (meta (last nodes))
29+
[:end-row :end-col]))]
30+
(with-meta (nforms/forms-node nodes) position-meta)))
3231

3332
;; ## Specialized Parsers
3433

0 commit comments

Comments
 (0)