Skip to content

Commit a6d0b54

Browse files
committed
need to put :const-expr in :context :expr
1 parent 7c140be commit a6d0b54

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/clojure/cljs/analyzer.cljc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,10 @@
12921292
(defn elide-env [env ast opts]
12931293
(dissoc ast :env))
12941294

1295+
(defn replace-env-pass [new-env]
1296+
(fn [env ast opts]
1297+
(assoc ast :env new-env)))
1298+
12951299
(defn constant-value?
12961300
[{:keys [op] :as ast}]
12971301
(or (= :constant op)
@@ -1393,7 +1397,7 @@
13931397
(when doc {:doc doc})
13941398
(when const?
13951399
(let [const-expr
1396-
(binding [*passes* (conj *passes* elide-env)]
1400+
(binding [*passes* (conj *passes* (replace-env-pass {:context :expr}))]
13971401
(analyze env (:init args)))]
13981402
(when (constant-value? const-expr)
13991403
{:const-expr const-expr})))

0 commit comments

Comments
 (0)