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/collect.x

Source-ordered shallow symbol collection and replay.

Functions

FunctionSummary
Compiler.add_linked_meta_provider_hashesRetains source proofs and one definition hash per linked provider.
Compiler.callable_symbolsReturns the collected source’s public type families and the declarations of names, including their receiver rows.
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.complete_meta_hashesCompletes a linked function’s own source hashes before a shallow call.
Compiler.configure_interfacesCreates the process cache and names the directories searched for .xi interfaces.
Compiler.configure_packageSelects a source file’s own package, as its standalone translation does.
Compiler.declared_adoptionsReturns the (adopt ...) rows that the current file’s collected entry declares, in no particular order.
Compiler.forget_provisional_entriesDrops the entries collected without declaration defaults while the shared compile-time session was filled, or by a project meta build.
Compiler.include_function_declarationsAdds the public functions an included unit itself declares.
Compiler.include_type_dependenciesThe semantic type rows reached by an ordinary source include.
Compiler.include_typedef_namesThe typedef names published by the files that the current unit’s include of target reaches, including its transitive includes.
Compiler.included_compile_time_effectsPrepares included compile-time effects after full parsing resets macros.
Compiler.inline_type_dependenciesRecords the actual type dependencies of typed public inline bodies.
Compiler.install_included_effectsInstalls the definitions of each include among the directives before the cursor.
Compiler.interface_textReturns the compiler’s own collected contribution as interface text, or NULL when the unit has not collected its symbols or the compiler’s identity is unknown, since no compiler could replay that interface.
Compiler.is_prelude_sourceReports whether the canonical path is a compiler prelude source.
Compiler.linked_meta_definitions_currentReports whether a provider’s linked definition hashes still match.
Compiler.linked_meta_provider_currentReports whether a linked provider and the files it read are unchanged.
Compiler.linked_prelude_recordsReturns the interface record text of each prelude component the compiler links, by home-portable path: the datum its .xi holds after the compiler identity.
Compiler.loaded_call_typeReturns the native calling type of a loaded function.
Compiler.loaded_providerReturns this source’s native definitions with their canonical declarations and the public type rows needed to check other units’ declarations.
Compiler.meta_provider_hashesReturns the shared function hashes of an advertised meta provider.
Compiler.module_sourceReturns the x2c source at path, whose own text is text, with its file-scope module block replaced by the text of each member it names, in order, or NULL when the text has no block.
Compiler.name_loaded_providerNames declared bindings through one loaded provider.
Compiler.name_meta_provider_bindingsSelects helper C spellings for public definitions owned by path.
Compiler.prelude_interfaceReturns the path of the first prelude interface this compiler wrote, or NULL when there is none or the compiler’s identity is unknown.
Compiler.prelude_sourcesReturns the compiler-owned prelude sources relative to its home.
Compiler.publish_inline_typesPromotes the selected type families after the owning ordinary full parse.
Compiler.publishes_type_familyReports whether this unit’s interface publishes the type family.
Compiler.publishes_typedefReports whether this unit’s selected interface publishes name.
Compiler.record_conformance_rowsReplaces the recorded conformance rows of the current file’s collected entry with rows, which join the declaration map its interface publishes, as record_generated_symbol adds its rows.
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.
Compiler.refresh_source_collectionsMakes the next collection recheck source files and interfaces after an interactive edit.
Compiler.replay_package_importsReplays package imports and public compile-time definitions in source order.
Compiler.runtime_function_declarationsThe runtime umbrella includes each listed module’s generated header.
SourceView.resolve_includeThe file the include of target from includer_dir names, searched as collection searches dirs, or NULL.

Compiler

Compiler.add_linked_meta_provider_hashes

void Compiler.add_linked_meta_provider_hashes(Compiler c, Map rows)

Retains source proofs and one definition hash per linked provider.

Source: src/collect/providers.x:110

Compiler.callable_symbols

Map Compiler.callable_symbols(Compiler c, List names)

Returns the collected source’s public type families and the declarations of names, including their receiver rows. Includes contribute their selected declarations, without replaying compile-time effects. Unselected functions and variables do not enter the result.

Source: src/collect/declarations.x:407

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/packages.x:25

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/walk.x:18

Compiler.complete_meta_hashes

void Compiler.complete_meta_hashes(Compiler c)

Completes a linked function’s own source hashes before a shallow call. A lookahead entry never replaces the file’s ordinary contribution.

Source: src/collect/providers.x:93

Compiler.configure_interfaces

void Compiler.configure_interfaces(String out_dir, int cold)

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. A cold process reads no interface and still writes its own. Call it before opening any translation unit’s Context.

Source: src/collect/interfaces.x:27

Compiler.configure_package

void Compiler.configure_package(Compiler c, List roots, String filename)

Selects a source file’s own package, as its standalone translation does. A cold provider does not register an import in its including unit.

Source: src/collect/walk.x:361

Compiler.declared_adoptions

List Compiler.declared_adoptions(Compiler c)

Returns the (adopt ...) rows that the current file’s collected entry declares, in no particular order. A file that imports a package declares none here: the walk that records them for a cold entry does not install a package’s surface.

Source: src/collect/declarations.x:599

Compiler.forget_provisional_entries

void Compiler.forget_provisional_entries(void)

Drops the entries collected without declaration defaults while the shared compile-time session was filled, or by a project meta build. Call once that session is published, and after the meta build’s parses.

Source: src/collect/cache.x:165

Compiler.include_function_declarations

void Compiler.include_function_declarations( Compiler c, String target, int angle, Map available)

Adds the public functions an included unit itself declares. Its collected include closure also contains private source includes, which its generated header need not publish. Those cannot supply declarations here. Meta signatures alone do not establish a runtime declaration either. Emission reads the entries collection already installed without invalidating them.

Source: src/collect/declarations.x:175

Compiler.include_type_dependencies

List Compiler.include_type_dependencies( Compiler c, String target, int angle, Map seen)

The semantic type rows reached by an ordinary source include. Each file contributes once to seen; the current unit does not contribute through a cycle back to its own still-open header.

Source: src/collect/declarations.x:135

Compiler.include_typedef_names

List Compiler.include_typedef_names( Compiler c, String target, int angle, Map seen)

The typedef names published by the files that the current unit’s include of target reaches, including its transitive includes. A file already in seen is skipped with the files it reaches, and each file reached is added to seen. NULL when the include does not resolve to x2c source; a runtime module adds nothing the prelude has not declared.

Source: src/collect/declarations.x:122

Compiler.included_compile_time_effects

Map Compiler.included_compile_time_effects(Compiler c, Map globs)

Prepares included compile-time effects after full parsing resets macros. The ordered cache walk counts each file once and groups effects by the canonical path of the unit’s direct include. The parser installs those effects when it reaches that include.

Source: src/collect/walk.x:597

Compiler.inline_type_dependencies

Map Compiler.inline_type_dependencies(Compiler c, List ast)

Records the actual type dependencies of typed public inline bodies.

Source: src/collect/declarations.x:438

Compiler.install_included_effects

void Compiler.install_included_effects(Compiler c)

Installs the definitions of each include among the directives before the cursor.

Source: src/collect/walk.x:642

Compiler.interface_text

String Compiler.interface_text(Compiler c)

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

Source: src/collect/interfaces.x:266

Compiler.is_prelude_source

int Compiler.is_prelude_source(String path)

Reports whether the canonical path is a compiler prelude source.

Source: src/collect/walk.x:68

Compiler.linked_meta_definitions_current

int Compiler.linked_meta_definitions_current(Compiler c, String path)

Reports whether a provider’s linked definition hashes still match. Changes outside definitions do not require a project helper.

Source: src/collect/providers.x:54

Compiler.linked_meta_provider_current

int Compiler.linked_meta_provider_current(Compiler c, String path)

Reports whether a linked provider and the files it read are unchanged. The linked inventory retains the ordinary collector’s dependency proof.

Source: src/collect/providers.x:8

Compiler.linked_prelude_records

Map Compiler.linked_prelude_records(Compiler c)

Returns the interface record text of each prelude component the compiler links, by home-portable path: the datum its .xi holds after the compiler identity. Each is walked cold by a compiler of its own, so the records hold this compiler’s collection rather than a table linked into it; the unit’s own entries for them are restored afterwards. A record the interface grammar cannot spell is left out.

Source: src/collect/interfaces.x:368

Compiler.loaded_call_type

Type Compiler.loaded_call_type(Compiler c, Type type)

Returns the native calling type of a loaded function. Array parameters decay to pointers, and a parameter’s outer qualifiers affect only its local copy. Keep the declared type for inspection and reload checks.

Source: src/collect/providers.x:176

Compiler.loaded_provider

List Compiler.loaded_provider(Compiler c)

Returns this source’s native definitions with their canonical declarations and the public type rows needed to check other units’ declarations.

Source: src/collect/providers.x:156

Compiler.meta_provider_hashes

Map Compiler.meta_provider_hashes(Compiler c, String provider)

Returns the shared function hashes of an advertised meta provider.

Source: src/collect/providers.x:106

Compiler.module_source

ModuleSource Compiler.module_source(Compiler c, String path, String text)

Returns the x2c source at path, whose own text is text, with its file-scope module block replaced by the text of each member it names, in order, or NULL when the text has no block. Member paths are relative to the file that names them, and their own blocks are spliced in turn. A member’s quoted include of a file beside it is spelled from the entry’s directory, so it names the same file there.

Source: src/collect/splice.x:28

Compiler.name_loaded_provider

void Compiler.name_loaded_provider( Compiler c, String path, int index, List provider)

Names declared bindings through one loaded provider. Its own source declarations remain authoritative; private bindings never link out.

Source: src/collect/providers.x:208

Compiler.name_meta_provider_bindings

void Compiler.name_meta_provider_bindings( Compiler c, String path, int index)

Selects helper C spellings for public definitions owned by path. Bindings, rather than source tokens, keep unrelated private names and fields unchanged. Native supplier declarations retain their C names.

Source: src/collect/providers.x:141

Compiler.prelude_interface

String Compiler.prelude_interface(void)

Returns the path of the first prelude interface this compiler wrote, or NULL when there is none or the compiler’s identity is unknown. Its source hashes are not checked.

Source: src/collect/interfaces.x:244

Compiler.prelude_sources

List Compiler.prelude_sources(void)

Returns the compiler-owned prelude sources relative to its home. Their runtime implementations are already linked into the shipped binaries.

Source: src/collect/walk.x:51

Compiler.publish_inline_types

void Compiler.publish_inline_types(Compiler c, List ast)

Promotes the selected type families after the owning ordinary full parse. The header and Xi then use the same complete family selection.

Source: src/collect/declarations.x:482

Compiler.publishes_type_family

int Compiler.publishes_type_family(Compiler c, List family)

Reports whether this unit’s interface publishes the type family.

Source: src/collect/declarations.x:227

Compiler.publishes_typedef

int Compiler.publishes_typedef(Compiler c, String name)

Reports whether this unit’s selected interface publishes name.

Source: src/collect/declarations.x:222

Compiler.record_conformance_rows

void Compiler.record_conformance_rows(Compiler c, Map rows)

Replaces the recorded conformance rows of the current file’s collected entry with rows, which join the declaration map its interface publishes, as record_generated_symbol adds its rows. A row an earlier cold walk recorded may sit in an earlier map. The cache retains each key and value.

Source: src/collect/declarations.x:575

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/declarations.x:555

Compiler.refresh_source_collections

void Compiler.refresh_source_collections(void)

Makes the next collection recheck source files and interfaces after an interactive edit. Drops cache indexes, retaining their backing rows: already-open units may still use those declarations.

Source: src/collect/cache.x:147

Compiler.replay_package_imports

void Compiler.replay_package_imports( Compiler c, Map globs, Map rows, Array exports)

Replays package imports and public compile-time definitions in source order. The shadow borrows the unit’s macro state and package registries. The full parse collects effects for the include line and leaves the unit’s own definitions at their source sites.

Source: src/collect/packages.x:194

Compiler.runtime_function_declarations

void Compiler.runtime_function_declarations(Compiler c, Map available)

The runtime umbrella includes each listed module’s generated header. Compiler components in the semantic prelude supply no runtime header.

Source: src/collect/declarations.x:184

SourceView

SourceView.resolve_include

String SourceView.resolve_include( SourceView s, List dirs, String includer_dir, String target, int angle)

The file the include of target from includer_dir names, searched as collection searches dirs, or NULL.

Source: src/collect/walk.x:452

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. The compiler’s own prelude components are linked into it as the records their interfaces would hold.