Expand description
Bare-name → FnId projection helpers for codegen boundary code.
call_graph is scope-local by design — every public fn operates on
a single scope (entry module OR one dep module), returns bare-name
results, and Aver’s module DAG invariant keeps cross-module SCCs
impossible so the bare-name keying is correct within a scope (see
project_aver_module_dag memory).
Codegen, however, needs FnId identity once it joins per-scope
results into a global view (CodegenContext.recursive_fns /
mutual_tco_members are FnId-keyed after #145 phase C). The
conversion is mechanical — pick FnKey::entry or FnKey::in_module
based on scope and look the ID up — but writing it inline in every
place that consumes a per-scope bare-name set turned build_context
/ refresh_facts / pipeline.rs proof setup into ~120 lines of
near-identical filter_map blocks. These two helpers collapse the
pattern.
Functions§
- analysis_
set_ to_ fn_ ids - Same shape as
bare_names_to_fn_idsbut accepts an iterator over&String(which is whatHashSet<String>/Vec<String>fromAnalysisResult.recursive_fns/mutual_tco_membersyields). Avoids.iter().map(String::as_str)ceremony at every call site. - bare_
names_ to_ fn_ ids - Project a sequence of bare fn names (as
&str) toFnIds through the symbol table.scope = Noneresolves names against the entry scope;Some(prefix)resolves against the dep module with that prefix. Names that don’t resolve (built-ins, synthetic helpers the table excludes) are dropped silently — same semantics every per-scope union loop already had.