Skip to content

Commit

Permalink
tweak reader/read call based on feedback from Nicola Mometto & Alex M…
Browse files Browse the repository at this point in the history
…iller
  • Loading branch information
swannodette committed Apr 9, 2015
1 parent ebee071 commit 6d4ee9c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/clj/cljs/analyzer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1964,22 +1964,24 @@
([^Reader rdr] (forms-seq* rdr nil))
([^Reader rdr filename]
{:pre [(instance? Reader rdr)]}
(let [opts (when (and filename (= (util/ext filename) "cljc"))
{:read-cond :allow :features #{:cljs}})
(let [eof-sentinel (Object.)
opts (merge
{:eof eof-sentinel}
(if (and filename (= (util/ext filename) "cljc"))
{:read-cond :allow :features #{:cljs}}))
pbr (readers/indexing-push-back-reader
(PushbackReader. rdr) 1 filename)
data-readers tags/*cljs-data-readers*
forms-seq_
(fn forms-seq_ []
(lazy-seq
(let [eof-sentinel (Object.)
form (binding [*ns* (create-ns *cljs-ns*)
(let [form (binding [*ns* (create-ns *cljs-ns*)
reader/*data-readers* data-readers
reader/*alias-map*
(apply merge
((juxt :requires :require-macros)
(get-namespace *cljs-ns*)))]
(reader/read pbr nil eof-sentinel opts nil))]
(reader/read opts pbr))]
(if (identical? form eof-sentinel)
(.close rdr)
(cons form (forms-seq_))))))]
Expand Down

0 comments on commit 6d4ee9c

Please sign in to comment.