(annotate-tag {:keys [op tag o-tag atom], :as ast})
If the AST node type is a constant object or contains :tag metadata,
attach the appropriate :tag and :o-tag to the node.
Source
(defn annotate-tag
"If the AST node type is a constant object or contains :tag metadata,
attach the appropriate :tag and :o-tag to the node."
{:pass-info {:walk :post :depends #{} :after #{#'constant-lift}}}
[{:keys [op tag o-tag atom] :as ast}]
(let [ast (if (and atom (:case-test @atom))
(update-in ast [:form] vary-meta dissoc :tag)
ast)
ast
(if (and o-tag tag)
ast
(if-let [tag (or tag
(-> ast :val meta :tag)
(-> ast :form meta :tag))]
(assoc (-annotate-tag ast) :tag tag)
(-annotate-tag ast)))]
(when (= op :binding)
(swap! atom assoc :tag (:tag ast)))
ast))