Expand description
Code node representation.
A CodeNode is our abstraction over raw AST nodes. It captures the semantically meaningful parts of code: what it is, where it lives, and enough metadata to be useful for graph construction.
Structs§
- Code
Node - A code entity extracted from source.
Enums§
- Node
Kind - The kind of code entity this node represents.
- Type
Relation Kind - A type relationship stored on a node until the graph builder resolves it.
- Visibility
- Visibility of a code entity.
Constants§
- EXTENDS_
REF_ PREFIX - Prefix on
CodeNode::referencesfor a superclass name. - FIELD_
REF_ PREFIX - Prefix for a field’s type stored on a struct node:
field:draft:Draft. - IMPLEMENTS_
REF_ PREFIX - Prefix on
CodeNode::referencesfor an implemented interface or trait. - IMPORT_
ALIAS_ REF_ PREFIX - Prefix on an import node’s references for a name imported under another
name:
alias:to_minor:money_to_minor_unitsforfrom money import money_to_minor_units as to_minor. - LOCAL_
BINDING_ REF_ PREFIX - Prefix for a name the file binds itself (a variable, a parameter, a destructured value), recorded on an import node with an empty module.
- MODULE_
FILE_ REF - A reference on the empty-module import node of a JavaScript or
TypeScript file that is a module: it has a top-level
importorexportstatement (TypeScript draws the line the same way), or a top-level CommonJSmodule.exports/exports.fassignment. A file without one is a script, whose top-level names are globals. - RETURNS_
REF_ PREFIX - Prefix for the type a function returns, stored on its node:
returns:PreparedDraftfor-> Option<mac::PreparedDraft>. Stripped like a field type, withSelfalready replaced by the impl type. - RUNTIME_
BINDING_ REF_ PREFIX - Prefix for a name an import node records as bound at run time from a value
its module produced:
bound:setFilters:setFiltersforconst { setFilters } = useListFilters()afterimport { useListFilters } from "./hooks".
Functions§
- clean_
type_ name - Strips pointers, references, and generic arguments from a type name.
- field_
ref - Encodes a struct field’s type as a reference.
- field_
type_ ref - Splits a
field:name:Typereference into the field name and its type. - import_
alias - Splits an
alias:local:importedreference into the local name and the imported name. - import_
alias_ ref - Encodes an aliased import as a reference on the import node.
- import_
qualified_ name - The qualified name of an import node: its module, then the byte where the
statement starts (
./hooks@120). The node’snamestays the module. - local_
binding - The name in a
local:namereference. - local_
binding_ ref - Encodes a name the file binds itself.
- return_
type_ ref - The return type recorded by a
returns:Typereference. - returns_
ref - Encodes a function’s (stripped) return type as a reference.
- runtime_
binding - Splits a
bound:local:namereference into the local name and the name to look for in the module. - runtime_
binding_ ref - Encodes a name bound from a value its module produced.
- type_
relation_ ref - Splits an
extends:/implements:reference into its kind and type name. - typed_
receiver - Splits a typed receiver reference into the method name and the receiver’s
type path (
TypeorType.field.field). - typed_
receiver_ ref - Encodes a method call whose receiver’s type is known from the code:
.run_started@Draft, or.run_started@AppState.draftfor a call on a field of a value of typeAppState.