Liking cljdoc? Tell your friends :D

kalai.pass.kalai.a-annotate-ast


annotate-newsclj


annotate-varsclj


ast-tclj

(ast-t ast)
(ast-t ast root)

Return the type represented by an AST node. root is an AST node that contains namespace information for ast. Type info returned is using the normalized form consisting of keywords, as described in [Design.md].

Return the type represented by an AST node. `root` is an AST node that
contains namespace information for `ast`. Type info returned is using the
normalized form consisting of keywords, as described in [Design.md].
raw docstring

clojure-typeclj

(clojure-type tag)

erase-type-aliasesclj

Takes a vector of ASTs, matches and removes kalias defs, leaves other ASTs alone. They remain in the environment of all subsequent AST nodes, and so can still be resolved.

Takes a vector of ASTs,
matches and removes kalias defs, leaves other ASTs alone.
They remain in the environment of all subsequent AST nodes,
and so can still be resolved.
raw docstring

normalize-t-in-astclj

(normalize-t-in-ast ast)

Normalizing t consists of: 0.5 If cast exists as a key, prefer using that over t as the type.

  1. If t is a valid Kalai type, it must be used.
  2. If t is a var, look up the kalias, which must be a Kalai type.
  3. If there is a tag, convert it to a Kalai type, and use that as t.
  4. If there is initialization, use the normalized initialization t.
  5. For initializations, if no t is present, use the binding t if present.
Normalizing t consists of:
0.5 If cast exists as a key, prefer using that over t as the type.
1. If t is a valid Kalai type, it must be used.
2. If t is a var, look up the kalias, which must be a Kalai type.
3. If there is a tag, convert it to a Kalai type, and use that as t.
4. If there is initialization, use the normalized initialization t.
5. For initializations, if no t is present, use the binding t if present.
raw docstring

propagate-ast-typeclj

(propagate-ast-type from-ast symbol-bind-site symbol-call-site ast)

If possible, associate the representative type of symbol-bind-site or from-ast to symbol-call-site, otherwise, just return symbol-call-site exactly as-is. Return symbol-call-site as-is if:

  • symbol-call-site cannot take metadata
  • symbol-call-site already has type info, as inferred by truthy value for :t in metadata
If possible, associate the representative type of `symbol-bind-site` or `from-ast` to `symbol-call-site`,
otherwise, just return `symbol-call-site` exactly as-is.
Return `symbol-call-site` as-is if:
  * `symbol-call-site` cannot take metadata
  * `symbol-call-site` already has type info, as inferred by truthy value for `:t` in
  metadata
raw docstring

propagate-types-from-bindings-to-localsclj

We propagate type information which is stored in metadata from the the place where they are declared on a symbol to all future usages of that symbol in scope.

We propagate type information which is stored in metadata
from the the place where they are declared on a symbol
to all future usages of that symbol in scope.
raw docstring

ref-varsclj


resolve-in-ast-nsclj

(resolve-in-ast-ns sym ast)

Tools analyzer does not evaluate metadata in bindings or arglists. They are symbols which we can resolve to vars. We have to resolve these symbols in the namespace that they were defined.

Tools analyzer does not evaluate metadata in bindings or arglists.
They are symbols which we can resolve to vars.
We have to resolve these symbols in the namespace that they were defined.
raw docstring

resolve-kaliasclj

(resolve-kalias sym ast)

We replace type aliases with their definition. We matched an AST node with meta data {:t T} where T is a var with meta {:kalias K}.

We replace type aliases with their definition.
We matched an AST node with meta data {:t T} where T is a var
with meta {:kalias K}.
raw docstring

resolve-tclj

(resolve-t x ast)

Takes a value that might have metadata, and an AST, and resolves the type. We also look at the :cast in metadata, because values can be cast, ex: a local might be cast to another type, in which we're interested in the type that is being casted to. See function ast-t, which relies on this behavior for locals. Note: "local" refers to symbols that refer to previously bound symbols, which are represented by tools.analyzer by :op :local.

Takes a value that might have metadata,
and an AST, and resolves the type.
We also look at the :cast in metadata, because values can be cast, ex: a local might be cast to another type, in which
we're interested in the type that is being casted to. See function `ast-t`, which relies on this behavior for locals.
Note: "local" refers to symbols that refer to previously bound symbols, which are represented by tools.analyzer by :op :local.
raw docstring

resolve-tagclj

(resolve-tag sym ast)

We didn't find a t, so we resolve tag and convert it to a Kalai type.

We didn't find a t, so we resolve tag and convert it to a Kalai type.
raw docstring

rewriteclj

(rewrite asts)

There is contextual information in the AST that is not available in s-expressions. The purpose of this pass is to capture that information and modify the s-expressions to contain what we need.

There is contextual information in the AST that is not available in s-expressions.
The purpose of this pass is to capture that information and modify the s-expressions to contain what we need.
raw docstring

set-ast-tclj

(set-ast-t ast t)

We match against both the collection and the type because maps must have a valid map type and we need the key value sub-types.

We match against both the collection and the type because maps must have
a valid map type and we need the key value sub-types.
raw docstring

set-coll-tclj

(set-coll-t val t)

t-from-metaclj

(t-from-meta x)

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close