1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! 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.
use HashSet;
use crate;
/// Project a sequence of bare fn names (as `&str`) to `FnId`s through
/// the symbol table. `scope = None` resolves 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.
/// Same shape as [`bare_names_to_fn_ids`] but accepts an iterator over
/// `&String` (which is what `HashSet<String>` / `Vec<String>` from
/// `AnalysisResult.recursive_fns` / `mutual_tco_members` yields). Avoids
/// `.iter().map(String::as_str)` ceremony at every call site.