pub struct CallGraph {
pub edges: HashMap<Symbol, HashSet<Symbol>>,
pub native_fns: HashSet<Symbol>,
pub sccs: Vec<Vec<Symbol>>,
}Expand description
Whole-program call graph for the LOGOS compilation pipeline.
Captures all direct and closure-embedded call edges between user-defined
functions. Used by ReadonlyParams for transitive mutation detection and
by liveness analysis for inter-procedural precision.
Fields§
§edges: HashMap<Symbol, HashSet<Symbol>>Direct call edges: fn_sym → set of directly called function symbols.
native_fns: HashSet<Symbol>Set of native (extern) function symbols.
sccs: Vec<Vec<Symbol>>Strongly connected components (Kosaraju’s algorithm).
Implementations§
Source§impl CallGraph
impl CallGraph
Sourcepub fn build(stmts: &[Stmt<'_>], _interner: &Interner) -> CallGraph
pub fn build(stmts: &[Stmt<'_>], _interner: &Interner) -> CallGraph
Build the call graph from a program’s top-level statements.
Walks all FunctionDef bodies, collecting Stmt::Call and
Expr::Call targets, including calls inside closure bodies.
Sourcepub fn reachable_from(&self, fn_sym: Symbol) -> HashSet<Symbol>
pub fn reachable_from(&self, fn_sym: Symbol) -> HashSet<Symbol>
Returns all functions reachable from fn_sym via the call graph.
Does not include fn_sym itself unless it is part of a cycle.
Sourcepub fn is_recursive(&self, fn_sym: Symbol) -> bool
pub fn is_recursive(&self, fn_sym: Symbol) -> bool
Returns true if fn_sym participates in a recursive cycle
(direct self-call or mutual recursion via SCC membership).