Expand description
The language half of Python’s resolution logic: module lookup, the export
index, the import binder, base-class resolution and the skeleton renderer,
written as free functions over a source trait instead of as methods on
PythonAnalyzer.
PythonAnalyzer (in brokk-bifrost-analysis) owns the lazy cells (seven
moka caches, one OnceLock and two PoolSafeMemos) and implements
PythonSource out of its own accessors, so the functions below
reach back for the memoized products they need without naming the analyzer
type.
Traits§
- Python
Source - The analyzer-resident products Python’s language logic resolves through, on top of the two core capability traits it reads declarations and imports with. The analyzer is the only implementor and every method forwards to one of its own accessors, so the cells stay where they are and no free function can reach past this surface.
- Python
Usage Source PythonSourceplus the built usage index. Everything reached from the export/importer walks needs it; the index build itself must not.
Functions§
- compute_
export_ index_ of - export_
index_ from_ file_ facts - extract_
type_ identifiers - import_
binder_ from_ imports - import_
bindings_ from_ imports - Resolve each structured import without collapsing repeated local names.
- public_
declarations_ in_ module - render_
skeleton_ recursive - resolve_
base_ class - resolve_
module_ code_ unit - resolve_
module_ code_ units_ batch - Batched sibling of
resolve_module_code_unit: resolves every FQN’s path-symbol lookup in one store transaction instead of one per FQN, then falls back to the (unbatched, rarer) definition-lookup path per FQN exactly as the single-FQN version does. Preserves its per-item semantics precisely, including that a path lookup which succeeds but finds no module unit does not fall through to the definition lookup.