cljs analyzer entrypoints via a file-local cljs compiler state.
Each cljs source file is read and analyzed inside one non-leaking compiler
state. This lets cljs.analyzer.api/forms-seq read with the analyzer's
current cljs namespace, cljs data readers, and alias map, then immediately
analyzes each top-level form against the same state. The file pass loads
macros but does not analyze required cljs dependencies; the state is local
to the source file and is not threaded through the checker.
cljs ASTs carry :type on :binding/:fn-method nodes that conflicts
with skeptic's :type slot (SemanticType), and :binding nodes lack
:form. analyze-form strips and synthesizes via normalize-cljs-node
so the skeptic annotate pipeline starts from a clean shape.
cljs analyzer entrypoints via a file-local cljs compiler state. Each cljs source file is read and analyzed inside one non-leaking compiler state. This lets `cljs.analyzer.api/forms-seq` read with the analyzer's current cljs namespace, cljs data readers, and alias map, then immediately analyzes each top-level form against the same state. The file pass loads macros but does not analyze required cljs dependencies; the state is local to the source file and is not threaded through the checker. cljs ASTs carry `:type` on `:binding`/`:fn-method` nodes that conflicts with skeptic's `:type` slot (SemanticType), and `:binding` nodes lack `:form`. `analyze-form` strips and synthesizes via `normalize-cljs-node` so the skeptic annotate pipeline starts from a clean shape.
(analyze-form ns-ast form)Inputs: [ns-ast :- aas/AnnotatedNode form :- s/Any] Returns: aas/AnnotatedNode
Analyze an already-read cljs form using the supplied ns AST. Real source
files should use analyze-source-file, which keeps cljs reading and
analysis in one file-local compiler state.
Inputs: [ns-ast :- aas/AnnotatedNode form :- s/Any] Returns: aas/AnnotatedNode Analyze an already-read cljs form using the supplied ns AST. Real source files should use `analyze-source-file`, which keeps cljs reading and analysis in one file-local compiler state.
(analyze-source-file source-file)Inputs: [source-file :- s/Any] Returns: ads/SourceFileAnalysis
Analyze every top-level form of a cljs/cljc source file using the cljs
analyzer's reader loop. Returns {:ns-ast ns-ast :entries [{:source-form form :ast ast} ...] :asts [ast ...]}. :entries
preserves the source-form/AST pairing needed by checker reporting; :asts
remains for collector compatibility.
Inputs: [source-file :- s/Any]
Returns: ads/SourceFileAnalysis
Analyze every top-level form of a cljs/cljc source file using the cljs
analyzer's reader loop. Returns `{:ns-ast ns-ast
:entries [{:source-form form :ast ast} ...] :asts [ast ...]}`. `:entries`
preserves the source-form/AST pairing needed by checker reporting; `:asts`
remains for collector compatibility.(find-by-op op ast)Inputs: [op :- s/Keyword ast :- aas/AnnotatedNode] Returns: (s/maybe aas/AnnotatedNode)
Return the first AST node whose :op is op, located by directed descent
through :children keys only. Mirrors walk-ast's pruning so callers do
not traverse :env, :info, :meta, or other non-AST slots that can
carry compiler-state cycles or large binding-info trees on real cljs ASTs.
Inputs: [op :- s/Keyword ast :- aas/AnnotatedNode] Returns: (s/maybe aas/AnnotatedNode) Return the first AST node whose `:op` is `op`, located by directed descent through `:children` keys only. Mirrors `walk-ast`'s pruning so callers do not traverse `:env`, `:info`, `:meta`, or other non-AST slots that can carry compiler-state cycles or large binding-info trees on real cljs ASTs.
(parse-source-ns source-file)Inputs: [source-file :- s/Any] Returns: aas/AnnotatedNode
Parse a .cljs / .cljc source file's (ns ...) form. Triggers JVM
loading of any :require-macros namespaces and returns the analyzed ns
AST: a map with :name, :requires, :require-macros, :uses, etc.
Suitable for use as the :ns slot of an analysis env passed to
analyze-form. Discards the ephemeral compiler state parse-ns auto-
creates internally; the JVM-loaded macro namespaces persist.
Inputs: [source-file :- s/Any] Returns: aas/AnnotatedNode Parse a `.cljs` / `.cljc` source file's `(ns ...)` form. Triggers JVM loading of any `:require-macros` namespaces and returns the analyzed ns AST: a map with `:name`, `:requires`, `:require-macros`, `:uses`, etc. Suitable for use as the `:ns` slot of an analysis env passed to `analyze-form`. Discards the ephemeral compiler state parse-ns auto- creates internally; the JVM-loaded macro namespaces persist.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |