Skip to content

Commit e8330a2

Browse files
mfikesdnolen
authored andcommitted
CLJS-1423: self-host: Requiring analyzer/compiler breaks unchecked Boolean
When analyzing, trap set! calls targeting *unchecked-if* iff the value is a compile-time boolean constant. Otherwise, if the cljs.analyzer namespace is required by ClojureScript code being compiled by ClojureScript-JVM, when the form (set! *unchecked-if* val) in the :cljs conditional-compilation branch is analyzed, it is unintentionally trapped and the *unchecked-if* is reset to the symbol 'val (which is truthy, causing the compiler to then emit unchecked if code).
1 parent 0d78c3f commit e8330a2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/clojure/cljs/analyzer.cljc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,8 +1589,9 @@
15891589
(disallowing-recur
15901590
(let [enve (assoc env :context :expr)
15911591
targetexpr (cond
1592-
;; TODO: proper resolve
1593-
(= target '*unchecked-if*)
1592+
(and
1593+
(= target '*unchecked-if*) ;; TODO: proper resolve
1594+
(or (true? val) (false? val)))
15941595
(do
15951596
#?(:clj (reset! *unchecked-if* val)
15961597
:cljs (set! *unchecked-if* val))

0 commit comments

Comments
 (0)