Skip to content

Commit 5d141f7

Browse files
author
dnolen
committed
CLJS-1120: analyze-deps does not appear to work when analyzing analysis caches
cljs.analyzer/no-warn: * incorrectly bound *analyze-deps* to false cljs.analyzer/analyze-file: * only take cache path if :cache-analysis true cljs.build-api-tests: * fix broken tests that assuemd *analyze-deps* false cljs.compiler/compile-file: * no need to cache analysis, will be handled by dependency analysis
1 parent 6097d1c commit 5d141f7

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

src/clj/cljs/analyzer.clj

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,7 @@
246246

247247
(defmacro no-warn [& body]
248248
(let [no-warnings (zipmap (keys *cljs-warnings*) (repeat false))]
249-
`(binding [*cljs-warnings* ~no-warnings
250-
*analyze-deps* false]
249+
`(binding [*cljs-warnings* ~no-warnings]
251250
~@body)))
252251

253252
(defmacro all-warn [& body]
@@ -2049,8 +2048,7 @@ argument, which the reader will use in any emitted errors."
20492048
path (if (instance? File res)
20502049
(.getPath ^File res)
20512050
(.getPath ^URL res))
2052-
cache (when (or (= (:ns ns-info) 'cljs.core)
2053-
(:cache-analysis opts))
2051+
cache (when (:cache-analysis opts)
20542052
(cache-file res ns-info output-dir))]
20552053
(when-not (get-in @env/*compiler* [::namespaces (:ns ns-info)])
20562054
(if (or (not cache)

src/clj/cljs/compiler.clj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,10 +1125,7 @@
11251125
{:recompile (into recompile (ana/ns-dependents ns))
11261126
:visited (conj visited ns)})))
11271127
ret))
1128-
(do
1129-
(when-not (contains? (::ana/namespaces @env/*compiler*) ns)
1130-
(with-core-cljs opts (fn [] (ana/analyze-file src-file opts))))
1131-
ns-info)))
1128+
ns-info))
11321129
(catch Exception e
11331130
(throw (ex-info (str "failed compiling file:" src) {:file src} e))))
11341131
(throw (java.io.FileNotFoundException. (str "The file " src " does not exist."))))))))

test/clj/cljs/build_api_tests.clj

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

4343
;; basic
4444

45-
(binding [ana/*cljs-ns* 'cljs.user]
45+
(binding [ana/*cljs-ns* 'cljs.user
46+
ana/*analyze-deps* false]
4647
(env/with-compiler-env test-cenv
4748
(ana/no-warn
4849
(ana/analyze test-env
@@ -51,20 +52,23 @@
5152

5253
;; linear
5354

54-
(binding [ana/*cljs-ns* 'cljs.user]
55+
(binding [ana/*cljs-ns* 'cljs.user
56+
ana/*analyze-deps* false]
5557
(env/with-compiler-env test-cenv
5658
(ana/no-warn
5759
(ana/analyze test-env
5860
'(ns foo.core)))))
5961

60-
(binding [ana/*cljs-ns* 'cljs.user]
62+
(binding [ana/*cljs-ns* 'cljs.user
63+
ana/*analyze-deps* false]
6164
(env/with-compiler-env test-cenv
6265
(ana/no-warn
6366
(ana/analyze test-env
6467
'(ns bar.core
6568
(:require [foo.core :as foo]))))))
6669

67-
(binding [ana/*cljs-ns* 'cljs.user]
70+
(binding [ana/*cljs-ns* 'cljs.user
71+
ana/*analyze-deps* false]
6872
(env/with-compiler-env test-cenv
6973
(ana/no-warn
7074
(ana/analyze test-env
@@ -73,20 +77,23 @@
7377

7478
;; graph
7579

76-
(binding [ana/*cljs-ns* 'cljs.user]
80+
(binding [ana/*cljs-ns* 'cljs.user
81+
ana/*analyze-deps* false]
7782
(env/with-compiler-env test-cenv
7883
(ana/no-warn
7984
(ana/analyze test-env
8085
'(ns graph.foo.core)))))
8186

82-
(binding [ana/*cljs-ns* 'cljs.user]
87+
(binding [ana/*cljs-ns* 'cljs.user
88+
ana/*analyze-deps* false]
8389
(env/with-compiler-env test-cenv
8490
(ana/no-warn
8591
(ana/analyze test-env
8692
'(ns graph.bar.core
8793
(:require [graph.foo.core :as foo]))))))
8894

89-
(binding [ana/*cljs-ns* 'cljs.user]
95+
(binding [ana/*cljs-ns* 'cljs.user
96+
ana/*analyze-deps* false]
9097
(env/with-compiler-env test-cenv
9198
(ana/no-warn
9299
(ana/analyze test-env

0 commit comments

Comments
 (0)