Skip to content

Commit 0f2a407

Browse files
Bruce Haumandnolen
authored andcommitted
CLJS-2581: Create a cljs.repl/*repl-env* dynamic var and bind it around cljs repl loops
1 parent 2b8d5ae commit 0f2a407

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/main/clojure/cljs/cli.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ present"
263263
(merge copts opts)))]
264264
(binding [ana/*cljs-ns* 'cljs.user
265265
repl/*repl-opts* opts
266-
ana/*verbose* (:verbose opts)]
266+
ana/*verbose* (:verbose opts)
267+
repl/*repl-env* renv]
267268
(when ana/*verbose*
268269
(util/debug-prn "Compiler options:" (pr-str repl/*repl-opts*)))
269270
(comp/with-core-cljs repl/*repl-opts*

src/main/clojure/cljs/core/server.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@
7979
(with-bindings
8080
(binding [*in* (or stdin in-reader)
8181
*out* (PrintWriter-on #(out-fn {:tag :out :val %1}) nil)
82-
*err* (PrintWriter-on #(out-fn {:tag :err :val %1}) nil)]
82+
*err* (PrintWriter-on #(out-fn {:tag :err :val %1}) nil)
83+
repl/*repl-env* repl-env]
8384
(let [opts (merge opts (:merge-opts (repl/setup repl-env opts)))]
8485
(binding [repl/*repl-opts* opts]
8586
(repl/evaluate-form repl-env env "<cljs repl>"

src/main/clojure/cljs/repl.cljc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
(def ^:dynamic *cljs-verbose* false)
3737
(def ^:dynamic *repl-opts* nil)
38+
(def ^:dynamic *repl-env* nil)
3839

3940
(def known-repl-opts
4041
"Set of all known REPL options."
@@ -856,7 +857,8 @@
856857
(env/with-compiler-env (or compiler-env (env/default-compiler-env opts))
857858
(when (:source-map opts)
858859
(.start (Thread. (bound-fn [] (read-source-map "cljs/core.aot.js")))))
859-
(binding [ana/*unchecked-if* false
860+
(binding [*repl-env* repl-env
861+
ana/*unchecked-if* false
860862
ana/*unchecked-arrays* false
861863
*err* (if bind-err
862864
(cond-> *out*

0 commit comments

Comments
 (0)