Skip to content

Commit 547d032

Browse files
author
dnolen
committed
CLJS-1080: Analysis cache should keep constants in visit order
Maintain constant visit order by tracking both seen and order
1 parent 7a3286f commit 547d032

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/clj/cljs/analyzer.clj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,12 @@
217217
table
218218
(assoc table val (gen-constant-id val))))))
219219
env (update-in [::namespaces (-> env :ns :name) ::constants]
220-
(fnil conj #{}) val))))))
220+
(fn [{:keys [seen order] :or {seen #{} order []} :as constants}]
221+
(cond-> constants
222+
(not (contains? seen val))
223+
(assoc
224+
:seen (conj seen val)
225+
:order (conj order val))))))))))
221226

222227
(def default-namespaces '{cljs.core {:name cljs.core}
223228
cljs.user {:name cljs.user}})
@@ -2005,7 +2010,7 @@ argument, which the reader will use in any emitted errors."
20052010
(swap! env/*compiler*
20062011
(fn [cenv]
20072012
(let [cached-ns (edn/read-string (slurp cache))]
2008-
(doseq [x (::constants cached-ns)]
2013+
(doseq [x (get-in cached-ns [::constants :order])]
20092014
(register-constant! x))
20102015
(-> cenv
20112016
(assoc-in [::analyzed-cljs path] true)

0 commit comments

Comments
 (0)