Skip to content

Commit f3cf45d

Browse files
author
dnolen
committed
CLJS-1385: cljs.js/compile-str does not correctly track the current ns.
1 parent 86f8255 commit f3cf45d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/cljs/cljs/js.cljs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -541,11 +541,11 @@
541541
the-ns (or (:ns opts) 'cljs.user)
542542
bound-vars (cond-> (merge bound-vars {:*cljs-ns* the-ns})
543543
(:source-map opts) (assoc :*sm-data* (sm-data)))]
544-
((fn compile-loop []
544+
((fn compile-loop [ns]
545545
(binding [env/*compiler* (:*compiler* bound-vars)
546546
*eval-fn* (:*eval-fn* bound-vars)
547-
ana/*cljs-ns* (:*cljs-ns* bound-vars)
548-
*ns* (create-ns (:*cljs-ns* bound-vars))
547+
ana/*cljs-ns* ns
548+
*ns* (create-ns ns)
549549
r/*data-readers* (:*data-readers* bound-vars)
550550
comp/*source-map-data* (:*sm-data* bound-vars)]
551551
(let [res (try
@@ -573,13 +573,13 @@
573573
(fn [res]
574574
(if (:error res)
575575
(cb res)
576-
(compile-loop))))
577-
(recur)))
576+
(compile-loop (:name ast)))))
577+
(recur ns)))
578578
(do
579579
(when (:source-map opts)
580580
(append-source-map env/*compiler*
581581
name source sb @comp/*source-map-data* opts))
582-
(cb {:value (.toString sb)})))))))))))
582+
(cb {:value (.toString sb)})))))))) the-ns)))
583583

584584
(defn compile-str
585585
"Compile ClojureScript source into JavaScript. The parameters:

0 commit comments

Comments
 (0)