Skip to main content

Module symbol_id

Module symbol_id 

Source
Expand description

Symbol identity: the one place that knows how a SymbolId is spelled.

Every adapter mints ids for the symbols it finds and, during resolution, rewrites placeholder ids into real ones. Both halves of that contract used to be duplicated per adapter, which let the spellings drift apart — the TypeScript adapter separated placeholder fields with | while the newer adapters used ::, a separator that also occurs inside Rust and C++ paths and therefore could not be parsed back out unambiguously.

§Resolved ids

relative/file/path.rs::SymbolName::kind — stable, persisted to the store, and the only form that may appear in a graph node.

§Placeholder ids

Emitted by extractors, consumed by resolvers, and never persisted. They use | as a field separator because | cannot occur in an identifier or a module path in any language we parse:

  • unresolved_import|<module>|<symbol> — an import awaiting module resolution
  • unresolved_local_type|<type> — a type reference awaiting local lookup

external_package_id is the exception: it survives resolution as a real graph node, because an edge to a third-party package is a fact worth keeping.

Constants§

IMPORT_ALL
The symbol value denoting “the module itself”, not a member of it.

Functions§

external_package_id
The id of the shared node representing a third-party package.
is_external_package
True if id names an external package node.
is_placeholder
True if id is any placeholder, i.e. resolution did not finish for it.
kind_suffix
The trailing component of a symbol id, identifying what kind of thing it is.
make_symbol_id
Mint the canonical id for a symbol defined at file.
module_symbol
Build the synthetic per-file module symbol.
module_symbol_id
The id of the synthetic per-file module symbol.
parse_external_package_id
Recover the package name from an external package id.
parse_symbol_id
Split a resolved symbol id back into (file, name, kind_suffix).
parse_unresolved_import_id
Recover (module, symbol) from an unresolved-import placeholder.
parse_unresolved_local_type_id
Recover the type name from a local-type placeholder.
symbol_name_of
The symbol name component of a resolved id, if it is one.
unresolved_import_id
Placeholder for an import of symbol from module, pending resolution.
unresolved_local_type_id
Placeholder for a reference to a type that must be looked up in file scope.