|
42 | 42 | ;; resolve alias
|
43 | 43 | sym-ns (when sym-ns (or (get-in the-current-ns [:aliases sym-ns])
|
44 | 44 | sym-ns))]
|
45 |
| - (or (find the-current-ns sym) ;; env can contain foo/bar symbols from bindings |
46 |
| - (cond |
47 |
| - (and sym-ns (or (= sym-ns 'clojure.core) (= sym-ns 'cljs.core))) |
48 |
| - (or (some-> env :namespaces (get 'clojure.core) (find sym-name)) |
49 |
| - (when-let [v (when call? (get ana-macros sym-name))] |
50 |
| - [sym v])) |
51 |
| - sym-ns |
52 |
| - (or (some-> env :namespaces sym-ns (find sym-name)) |
53 |
| - (when-let [clazz (interop/resolve-class ctx sym-ns)] |
54 |
| - [sym (with-meta |
55 |
| - [clazz sym-name] |
56 |
| - #?(:clj |
57 |
| - (if call? |
58 |
| - {:sci.impl.analyzer/static-access true} |
59 |
| - {:sci.impl/op :static-access |
60 |
| - :file @vars/current-file |
61 |
| - :ns @vars/current-ns}) |
62 |
| - :cljs {:sci.impl/op :static-access}))])) |
63 |
| - :else |
64 |
| - ;; no sym-ns, this could be a symbol from clojure.core |
65 |
| - (or |
66 |
| - (let [kv (some-> env :namespaces (get 'clojure.core) (find sym-name))] |
67 |
| - ;; only valid when the symbol isn't excluded |
68 |
| - (when-not (some-> the-current-ns |
69 |
| - :refer |
70 |
| - (get 'clojure.core) |
71 |
| - :exclude |
72 |
| - (contains? sym-name)) |
73 |
| - kv)) |
74 |
| - ;; TODO: we can unify clojure core and refers into one thing |
75 |
| - (find (:refers the-current-ns) sym-name) |
76 |
| - (when (when call? (get ana-macros sym)) |
77 |
| - [sym sym]) |
78 |
| - (when-let [c (interop/resolve-class ctx sym)] |
79 |
| - [sym c]) |
80 |
| - ;; resolves record or protocol referenced as class |
81 |
| - ;; e.g. clojure.lang.IDeref which is really a var in clojure.lang/IDeref |
82 |
| - (when-let [x (records/resolve-record-or-protocol-class ctx sym)] |
83 |
| - [sym x])))))) |
| 45 | + (if sym-ns |
| 46 | + (or |
| 47 | + (when (or (= sym-ns 'clojure.core) (= sym-ns 'cljs.core)) |
| 48 | + (or (some-> env :namespaces (get 'clojure.core) (find sym-name)) |
| 49 | + (when-let [v (when call? (get ana-macros sym-name))] |
| 50 | + [sym v]))) |
| 51 | + (or (some-> env :namespaces sym-ns (find sym-name)) |
| 52 | + (when-let [clazz (interop/resolve-class ctx sym-ns)] |
| 53 | + [sym (with-meta |
| 54 | + [clazz sym-name] |
| 55 | + #?(:clj |
| 56 | + (if call? |
| 57 | + {:sci.impl.analyzer/static-access true} |
| 58 | + {:sci.impl/op :static-access |
| 59 | + :file @vars/current-file |
| 60 | + :ns @vars/current-ns}) |
| 61 | + :cljs {:sci.impl/op :static-access}))]))) |
| 62 | + ;; no sym-ns |
| 63 | + (or |
| 64 | + ;; prioritize refers over vars in the current namespace, see 527 |
| 65 | + (when-let [refers (:refers the-current-ns)] |
| 66 | + (find refers sym-name)) |
| 67 | + (find the-current-ns sym) ;; env can contain foo/bar symbols from bindings |
| 68 | + (let [kv (some-> env :namespaces (get 'clojure.core) (find sym-name))] |
| 69 | + ;; only valid when the symbol isn't excluded |
| 70 | + (when-not (some-> the-current-ns |
| 71 | + :refer |
| 72 | + (get 'clojure.core) |
| 73 | + :exclude |
| 74 | + (contains? sym-name)) |
| 75 | + kv)) |
| 76 | + (when (when call? (get ana-macros sym)) |
| 77 | + [sym sym]) |
| 78 | + (when-let [c (interop/resolve-class ctx sym)] |
| 79 | + [sym c]) |
| 80 | + ;; resolves record or protocol referenced as class |
| 81 | + ;; e.g. clojure.lang.IDeref which is really a var in clojure.lang/IDeref |
| 82 | + (when-let [x (records/resolve-record-or-protocol-class ctx sym)] |
| 83 | + [sym x]))))) |
84 | 84 |
|
85 | 85 | (defn tag [_ctx expr]
|
86 | 86 | (when-let [m (meta expr)]
|
|
0 commit comments