Skip to content

Commit f4b6f56

Browse files
committed
- move global-ns? predicate to analyzer
1 parent dd85919 commit f4b6f56

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/main/clojure/cljs/analyzer.cljc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2820,9 +2820,13 @@
28202820
(error env
28212821
(error-message :undeclared-ns {:ns-sym dep :js-provide (name dep)}))))))))))))
28222822

2823+
(defn global-ns? [x]
2824+
(or (= 'js x)
2825+
(= "js" (namespace x))))
2826+
28232827
(defn missing-use? [lib sym cenv]
28242828
;; ignore globals referred via :refer-global
2825-
(when-not (= 'js lib)
2829+
(when-not (global-ns? lib)
28262830
(let [js-lib (get-in cenv [:js-dependency-index (name lib)])]
28272831
(and (= (get-in cenv [::namespaces lib :defs sym] ::not-found) ::not-found)
28282832
(not (= (get js-lib :group) :goog))

src/main/clojure/cljs/repl.cljc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,18 +251,14 @@
251251
(load-sources repl-env sources opts)
252252
sources)))
253253

254-
(defn global-ns? [x]
255-
(or (= 'js x)
256-
(= "js" (namespace x))))
257-
258254
(defn- load-dependencies
259255
"Compile and load the given `requires` and return the compiled sources."
260256
([repl-env requires]
261257
(load-dependencies repl-env requires nil))
262258
([repl-env requires opts]
263259
(->> requires
264260
distinct
265-
(remove global-ns?)
261+
(remove ana/global-ns?)
266262
(mapcat #(load-namespace repl-env % opts))
267263
doall)))
268264

0 commit comments

Comments
 (0)