(infer-tag {:keys [tag form], :as ast})
Performs local type inference on the AST adds, when possible,
one or more of the following keys to the AST:
* :o-tag represents the current type of the
expression represented by the node
* :tag represents the type the expression represented by the
node is required to have, possibly the same as :o-tag
* :return-tag implies that the node will return a function whose
invocation will result in a object of this type
* :arglists implies that the node will return a function with
this arglists
* :ignore-tag true when the node is untyped, does not imply that
all untyped node will have this
Passes opts:
* :infer-tag/level If :global, infer-tag will perform Var tag
inference
Source
(defn infer-tag
"Performs local type inference on the AST adds, when possible,
one or more of the following keys to the AST:
* :o-tag represents the current type of the
expression represented by the node
* :tag represents the type the expression represented by the
node is required to have, possibly the same as :o-tag
* :return-tag implies that the node will return a function whose
invocation will result in a object of this type
* :arglists implies that the node will return a function with
this arglists
* :ignore-tag true when the node is untyped, does not imply that
all untyped node will have this
Passes opts:
* :infer-tag/level If :global, infer-tag will perform Var tag
inference"
{:pass-info {:walk :post :depends #{#'annotate-tag #'annotate-host-info #'fix-case-test #'analyze-host-expr} :after #{#'trim}}}
[{:keys [tag form] :as ast}]
(let [tag (or tag (:tag (meta form)))
ast (-infer-tag ast)]
(merge ast
(when tag
{:tag tag})
(when-let [o-tag (:o-tag ast)]
{:o-tag o-tag}))))