(defn ns-side-effects
[env {:keys [op] :as ast} opts]
(if (#{:ns :ns*} op)
(let [{:keys [name deps uses require-macros use-macros reload reloads]} ast]
(when (and *analyze-deps* (seq deps))
(analyze-deps
(if (repl-self-require? env deps) 'cljs.user name)
deps env (dissoc opts :macros-ns)))
(if *load-macros*
(do
(load-core)
(doseq [nsym (vals use-macros)]
(let [k (or (:use-macros reload)
(get-in reloads [:use-macros nsym])
(and (= nsym name) *reload-macros* :reload))]
(if k
(locking load-mutex
(clojure.core/require nsym k))
(locking load-mutex
(clojure.core/require nsym)))
(intern-macros nsym k)))
(doseq [nsym (vals require-macros)]
(let [k (or (:require-macros reload)
(get-in reloads [:require-macros nsym])
(and (= nsym name) *reload-macros* :reload))]
(if k
(locking load-mutex
(clojure.core/require nsym k))
(locking load-mutex
(clojure.core/require nsym)))
(intern-macros nsym k)))
(-> ast
(check-use-macros-inferring-missing env)
(check-rename-macros-inferring-missing env)))
(do
(check-uses
(when (and *analyze-deps* (seq uses))
(missing-uses uses env))
env)
ast)))
ast))