Skip to content

Commit c59e957

Browse files
author
dnolen
committed
CLJS-1570: :parallel-build causes invalid truth check in cljs.reader/read-number
make cljs.analyzer/*unchecked-if* a dynamic var with a default value of `false`. bind it around file scopes so that we can set! it thread locally, sufficient for parallel builds which works a file at a time. ClojureScript & bootstrapped can now share logic.
1 parent d3a9444 commit c59e957

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/main/clojure/cljs/analyzer.cljc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
(def ^:dynamic *cljs-ns* 'cljs.user)
4444
(def ^:dynamic *cljs-file* nil)
45-
#?(:clj (def ^:dynamic *unchecked-if* (atom false)))
45+
#?(:clj (def ^:dynamic *unchecked-if* false))
4646
(def ^:dynamic *cljs-static-fns* false)
4747
(def ^:dynamic *cljs-macros-path* "/cljs/core")
4848
(def ^:dynamic *cljs-macros-is-classpath* true)
@@ -981,8 +981,7 @@
981981
else-expr (allowing-redef (analyze env else))]
982982
{:env env :op :if :form form
983983
:test test-expr :then then-expr :else else-expr
984-
:unchecked #?(:clj @*unchecked-if*
985-
:cljs *unchecked-if*)
984+
:unchecked *unchecked-if*
986985
:children [test-expr then-expr else-expr]}))
987986

988987
(defmethod parse 'case*
@@ -1589,8 +1588,7 @@
15891588
(= target '*unchecked-if*) ;; TODO: proper resolve
15901589
(or (true? val) (false? val)))
15911590
(do
1592-
#?(:clj (reset! *unchecked-if* val)
1593-
:cljs (set! *unchecked-if* val))
1591+
(set! *unchecked-if* val)
15941592
::set-unchecked-if)
15951593

15961594
(symbol? target)
@@ -2846,7 +2844,8 @@
28462844
([f opts]
28472845
(analyze-file f false opts))
28482846
([f skip-cache opts]
2849-
(binding [*file-defs* (atom #{})]
2847+
(binding [*file-defs* (atom #{})
2848+
*unchecked-if* false]
28502849
(let [output-dir (util/output-directory opts)
28512850
res (cond
28522851
(instance? File f) f

src/main/clojure/cljs/compiler.cljc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,8 @@
13331333
(compile-file src dest nil))
13341334
([src dest opts]
13351335
{:post [map?]}
1336-
(binding [ana/*file-defs* (atom #{})]
1336+
(binding [ana/*file-defs* (atom #{})
1337+
ana/*unchecked-if* false]
13371338
(let [nses (get @env/*compiler* ::ana/namespaces)
13381339
src-file (io/file src)
13391340
dest-file (io/file dest)

0 commit comments

Comments
 (0)