Skip to content

Commit 5a0154e

Browse files
plexusbbatsov
authored andcommitted
Fix ClojureScript macroexpand failures
The `with-cljs-env` macro tried to grab the ClojureScript compiler env during macroexpansion, at which point it may not be set yet. This was causing issues where the ClojureScript compiler found an `*env*` of `nil`, causing a NullPointerException, which was then getting swallowed by the test code. Instead, grab the env at runtime.
1 parent 8084537 commit 5a0154e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cider/nrepl/middleware/util/cljs.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
[x]
5050
(if (instance? clojure.lang.IDeref x) @x x))
5151

52-
(defn- grab-cljs-env*
52+
(defn grab-cljs-env*
5353
[msg]
5454
(let [path (cljs-env-path)]
5555
(some-> msg
@@ -84,7 +84,7 @@
8484
(defmacro with-cljs-env [msg & body]
8585
(try
8686
(require 'cljs.env)
87-
`(binding [cljs.env/*compiler* ~(grab-cljs-env* msg)]
87+
`(binding [cljs.env/*compiler* (grab-cljs-env* ~msg)]
8888
~@body)
8989
(catch Exception _)))
9090

0 commit comments

Comments
 (0)