Liking cljdoc? Tell your friends :D

skeptic.cljs.analyzer-driver

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.
raw docstring

analyze-formclj

(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.
sourceraw docstring

analyze-source-fileclj

(analyze-source-file source-file)
(analyze-source-file state source-file)

Inputs: ([source-file :- s/Any] [state :- s/Any 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.

Arity-1 creates a fresh, file-local compiler state — analyses are isolated. Arity-2 takes a caller-supplied state so callers driving a multi-file pass can share [::namespaces] across analyses; macros that introspect earlier-parsed nss at expansion time then find them.

Inputs: ([source-file :- s/Any] [state :- s/Any 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.

Arity-1 creates a fresh, file-local compiler state — analyses are
isolated. Arity-2 takes a caller-supplied state so callers driving a
multi-file pass can share `[::namespaces]` across analyses; macros that
introspect earlier-parsed nss at expansion time then find them.
sourceraw docstring

empty-stateclj

(empty-state)

Empty cljs compiler state with :spec-skip-macros true. Skeptic does not validate cljs macro-syntax specs (e.g. :cljs.core.specs.alpha/ns-form); those specs bind Skeptic to whichever cljs.core.specs.alpha shipped with the bundled cljs version, breaking on projects that use ns-clauses (:refer-global, etc.) newer than the bundled spec knows. The analyzer's own 'ns parser handles these clauses via ns-spec-cases; only the spec validator was out-of-date. do-macroexpand-check (analyzer.cljc:4252) honors this option.

Empty cljs compiler state with `:spec-skip-macros true`. Skeptic
does not validate cljs macro-syntax specs
(e.g. `:cljs.core.specs.alpha/ns-form`); those specs bind Skeptic to
whichever `cljs.core.specs.alpha` shipped with the bundled cljs
version, breaking on projects that use ns-clauses (`:refer-global`,
etc.) newer than the bundled spec knows. The analyzer's own 'ns
parser handles these clauses via `ns-spec-cases`; only the spec
validator was out-of-date. `do-macroexpand-check`
(`analyzer.cljc:4252`) honors this option.
sourceraw docstring

find-by-opclj

(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.
sourceraw docstring

parse-source-nsclj

(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. Wraps the call in a Skeptic-configured empty state so cljs macro-syntax spec validation is skipped; the state is discarded on return, while 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`. Wraps the call in a Skeptic-configured empty state so
cljs macro-syntax spec validation is skipped; the state is discarded
on return, while JVM-loaded macro namespaces persist.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close