Skip to main content

build_context

Function build_context 

Source
pub fn build_context(
    items: Vec<TopLevel>,
    _tc_result: &TypeCheckResult,
    entry_analysis: Option<&AnalysisResult>,
    project_name: String,
    modules: Vec<ModuleInfo>,
    symbol_table: SymbolTable,
    resolved_items: Vec<ResolvedTopLevel>,
) -> CodegenContext
Expand description

Build a CodegenContext from parsed + type-checked items.

entry_analysis is the analyze stage output for items (entry module). When provided, codegen reads mutual_tco_members, recursive_fns, and per-fn FnAnalysis from it instead of recomputing. Each ModuleInfo in modules carries its own per-module analysis; codegen unions the per-module sets to build a global view (sound under Aver’s module DAG invariant — no cross-module SCCs possible, see src/ir/analyze.rs doc).

symbol_table is the resolved-identity layer built by the pipeline (pipeline_result.symbol_table). Always required: pipeline::run builds it unconditionally so every caller has one available. The ad-hoc test helpers that drive a stripped pipeline build their own via SymbolTable::build(&items, &modules) and pass it here.