Skip to content

Commit b6a9dc0

Browse files
committed
revert cljs.closure/compile-file "optimization", must always populate
compilation environment with analysis information, not doing so damages composition of namespaces with smaller compilation units like expressions. the problem was uncovered by starting REPLs with cached files, the second run would be borked because we compiled core but did not populate the compilation environment. Include comment covering this point as well.
1 parent 2bb2d0b commit b6a9dc0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/clj/cljs/compiler.clj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,13 @@
11251125
{:recompile (into recompile (ana/ns-dependents ns))
11261126
:visited (conj visited ns)})))
11271127
ret))
1128-
ns-info))
1128+
(do
1129+
;; always populate compilation environment with analysis information
1130+
;; while it would seem this isn't necessary avoiding to do so damages
1131+
;; composition of smaller compilation units like expressions (i.e. REPLs)
1132+
(when-not (contains? (::ana/namespaces @env/*compiler*) ns)
1133+
(with-core-cljs opts (fn [] (ana/analyze-file src-file opts))))
1134+
ns-info)))
11291135
(catch Exception e
11301136
(throw (ex-info (str "failed compiling file:" src) {:file src} e))))
11311137
(throw (java.io.FileNotFoundException. (str "The file " src " does not exist."))))))))

0 commit comments

Comments
 (0)