x-lang

← Index

x/tool/lint

AST linter via the type-system write stacks: name-based def/use analysis + first/rest + tail-def-leak + pedantic (arity / non-callable / duplicate-def) checks.

Class Lint

%lint-class-siblings

Sibling method names of the class being walked

Member: data carried by a Lint instance.

%lint-embedder-known

Embedder-contract names, announced before any file runs

Member: data carried by a Lint instance.

%lint-block-selectors

Selectors carrying a block form (x/type/block); one entry per shipped wrap

Member: data carried by a Lint instance.

(Lint %lint-all-syms? xs)

(Lint %lint-names-at? args)

(Lint %lint-new-names? xs)

(Lint %lint-resolves? sym)

(Lint %lint-block-send? sel args)

(Lint %lint-block-form? form)

(Lint %lint-block-form! form)

(Lint %lint-block-body args)

(Lint %lint-out-verb? form)

(Lint %ladder-keyed form var)

(Lint %env-known? name)

(Lint %lint-doc form)

(Lint %lint-class-methods clauses acc)

(Lint %lint-class-clause c)

(Lint %lint-method form)

(Lint %lint-class form)

(Lint %lint-class-prepass forms)

(Lint %lint-computed-call form)

lint-forms

Walk top-level forms via the write stacks, collecting def/use names, first/rest issues, tail-position def leaks, and pedantic warnings (arity, non-callable calls, duplicate defs, malformed forms, lexical shadows, and unused locals).

Returns: LIST — (defs uses issues leaks warnings) – defs/uses/issues/leaks are NAME STRINGS; warnings are (kind . name) pairs for arity / call-nonfn / display-chain / dup-def / ladder / ladder-dict / malformed / match-multi / shadow / unused; ladder names carry the arm count as NAME/ARMS

lint-undefined

Compute undefined names: used but not in env or file defs.

Returns: LIST — Names used but not defined

lint-unused

Compute unused names: defined but not referenced. Skips %-prefixed internals.

Returns: LIST — Names defined but never used

lint-first-rest

Extract the first/rest-on-non-list findings from a lint-forms result.

Returns: LIST — Op names (first/rest) applied to a literal non-list

lint-leaks

Extract the tail-position-def leak findings from a lint-forms result.

Returns: LIST — Def names that bind in tail position (leak to global; use let)

lint-warnings

Extract all pedantic warnings (arity, call-nonfn, dup-def, …) from a result.

Returns: LIST — Pedantic findings as (kind . name) pairs

lint-warnings-of

Filter pedantic warnings to one kind, returning their names.

Returns: LIST — The names for warnings of that kind

lint-has?

Test whether a name string is in a names list (string equality).

Returns: BOOL — #t if name is in names