Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.

src/collect.x

Source-ordered shallow symbol collection and replay.

Functions

FunctionSummary
interface_configureCreates the process cache and names the directories searched for .xi interfaces.
interface_preludeReturns the readable prelude interface path, or NULL when none exists.
interface_textReturns the compiler’s own collected contribution as interface text, or NULL when the unit has not collected its symbols.
Compiler.collect_packageCollects a package once and installs its public surface in the current unit.
Compiler.collect_symbolsCollects the current translation unit’s declarations into globs.
Compiler.record_generated_symbolRecords one generated public callable in the declaration map that the current file’s collected entry contributes, which is the map its interface publishes.

Functions

interface_configure

void interface_configure(String out_dir)

Creates the process cache and names the directories searched for .xi interfaces. out_dir is the current translation output directory, or NULL. Home files mirror their home-relative path under the compiler’s stage directory when it runs from <home>/builds/, otherwise under the home. Call it before opening any translation unit’s Context.

Source: src/collect.x:707

interface_prelude

String interface_prelude(void)

Returns the readable prelude interface path, or NULL when none exists.

Source: src/collect.x:732

interface_text

String interface_text(Compiler compiler)

Returns the compiler’s own collected contribution as interface text, or NULL when the unit has not collected its symbols. A contribution that the interface grammar cannot spell is reported as an emit diagnostic.

Source: src/collect.x:954

Compiler

Compiler.collect_package

void Compiler.collect_package(Compiler c, String name, Token token)

Collects a package once and installs its public surface in the current unit. name resolves through the compiler’s registered package roots. A cold entry include closure is parsed in package mode; cached entries replay their previously collected declarations. Public declarations and protocol rows enter the current symbol state, and dependencies enter the importing compiler. Replay also merges recorded function definitions. token locates lookup and public-surface errors.

Source: src/collect.x:655

Compiler.collect_symbols

Map Compiler.collect_symbols(Compiler c, Map globs)

Collects the current translation unit’s declarations into globs. The compiler must have its filename, text, and include paths prepared. globs is the base symbol map and is mutated; a null value starts from an empty map. A prelude unit first replays the runtime contribution, or walks lib/x2c.x cold when it must not skip runtime headers. The source and raw-include closure then merge in source order, and the returned map is globs. Collection also updates dependencies, function definitions, and macro state. Keyword alias maps and seen-name state are file-local and restored when each file walk ends.

Source: src/collect.x:495

Compiler.record_generated_symbol

void Compiler.record_generated_symbol( Compiler c, String name, Type signature)

Records one generated public callable in the declaration map that the current file’s collected entry contributes, which is the map its interface publishes. A file without a collected declaration map records nothing. The cache retains signature.

Source: src/collect.x:349

Design notes

Raw collection scans includes without running cpp. Each cold walk records declaration maps and included paths at their source positions; cache and interface replay consume that same order so declaration precedence does not depend on whether a file was already collected. A translated unit writes its own contribution beside its generated C as a .xi interface, and the runtime prelude is lib/x2c.xi.