(intern-macros ns)
(intern-macros ns reload)
Given a Clojure namespace intern all macros into the ambient ClojureScript
analysis environment.
Source
(defn intern-macros
"Given a Clojure namespace intern all macros into the ambient ClojureScript
analysis environment."
([ns] (intern-macros ns false))
([ns reload]
(when (or (nil? (get-in @env/*compiler* [::namespaces ns :macros]))
reload)
(swap! env/*compiler* assoc-in [::namespaces ns :macros]
(->> #?(:clj (ns-interns ns) :cljs (ns-interns* ns))
(filter (fn [[_ ^Var v]] (.isMacro v)))
(map (fn [[k v]]
[k (as-> (meta v) vm
(let [ns (.getName ^Namespace (:ns vm))]
(assoc vm
:ns ns
:name (symbol (str ns) (str k))
:macro true)))]))
(into {}))))))