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) -> Self
pub fn build(stmts: &[Stmt<'_>], _interner: &Interner) -> Self
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).
Auto Trait Implementations§
impl Freeze for CallGraph
impl RefUnwindSafe for CallGraph
impl Send for CallGraph
impl Sync for CallGraph
impl Unpin for CallGraph
impl UnsafeUnpin for CallGraph
impl UnwindSafe for CallGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.