Skip to content

Commit eeb86ae

Browse files
committed
Merge branch 'master' of github.com:clojure/clojurescript
2 parents 42c6930 + 25602b9 commit eeb86ae

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/clj/cljs/core.clj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,6 +1440,11 @@
14401440
cljs.analyzer/*cljs-file*)))))
14411441
(assoc m test expr)))
14421442

1443+
(defn- const? [env x]
1444+
(core/let [m (core/and (core/list? x)
1445+
(ana/resolve-var env (last x)))]
1446+
(core/when m (core/get m :const))))
1447+
14431448
(defmacro case
14441449
"Takes an expression, and a set of clauses.
14451450
@@ -1487,10 +1492,9 @@
14871492
(assoc-test m test expr env)))
14881493
{} (partition 2 clauses))
14891494
esym (gensym)
1490-
const? #(:const (and (list? %) (ana/resolve-var env (last %))))
14911495
tests (keys pairs)]
14921496
(cond
1493-
(every? (some-fn core/number? core/string? core/char? const?) tests)
1497+
(every? (some-fn core/number? core/string? core/char? #(const? env %)) tests)
14941498
(core/let [no-default (if (odd? (count clauses)) (butlast clauses) clauses)
14951499
tests (mapv #(if (seq? %) (vec %) [%]) (take-nth 2 no-default))
14961500
thens (vec (take-nth 2 (drop 1 no-default)))]

0 commit comments

Comments
 (0)