(defn get-expander* [sym env]
(when-not (or (some? (gets env :locals sym)) ; locals hide macros
(and (excluded? env sym) (not (used? env sym))))
(let [nstr (namespace sym)]
(cond
(some? nstr)
(let [ns (get-expander-ns env nstr)]
(when (some? ns)
(.findInternedVar ^clojure.lang.Namespace ns (symbol (name sym)))))
(some? (gets env :ns :rename-macros sym))
(let [qualified-symbol (gets env :ns :rename-macros sym)
nsym (symbol (namespace qualified-symbol))
sym (symbol (name qualified-symbol))]
(.findInternedVar ^clojure.lang.Namespace
#?(:clj (find-ns nsym) :cljs (find-macros-ns nsym)) sym))
:else
(let [nsym (gets env :ns :use-macros sym)]
(if (and (some? nsym) (symbol? nsym))
(.findInternedVar ^clojure.lang.Namespace
#?(:clj (find-ns nsym) :cljs (find-macros-ns nsym)) sym)
(.findInternedVar ^clojure.lang.Namespace
#?(:clj (find-ns 'cljs.core) :cljs (find-macros-ns CLJS_CORE_MACROS_SYM)) sym)))))))