Skip to content

Commit 1d3e4d6

Browse files
committed
fix constant table stability issue
Analysis cache loading path would not correctly merge in all data collected from analyzing dependencies (would drop accumulated constants).
1 parent e37b4da commit 1d3e4d6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/main/clojure/cljs/analyzer.cljc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2691,8 +2691,11 @@
26912691
(recur (rest forms))))
26922692
(throw (AssertionError. (str "No ns form found in " src)))))))]
26932693
(when (false? (:restore opts))
2694-
(swap! env/*compiler* update-in [::namespaces] merge
2695-
(get compiler-env' ::namespaces)))
2694+
(swap! env/*compiler*
2695+
(fn [old-state]
2696+
(-> old-state
2697+
(update-in [::namespaces] merge (get compiler-env' ::namespaces))
2698+
(update-in [::constant-table] merge (get compiler-env' ::constant-table))))))
26962699
ijs)))))
26972700

26982701
#?(:clj

src/main/clojure/cljs/env.cljc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ state that is accessed/maintained by many different components."}
4242
([] (default-compiler-env {}))
4343
([options]
4444
(atom (merge {:cljs.analyzer/namespaces {'cljs.user {:name 'cljs.user}}
45+
:cljs.analyzer/constant-table {}
4546
:options options}
4647
#?(:clj {:js-dependency-index (js-dependency-index options)})))))
4748

0 commit comments

Comments
 (0)