fallow_engine/
trace_chain.rs1use crate::{EngineError, EngineResult, session::AnalysisSession};
4
5use fallow_types::trace_chain::{SymbolChainQuery, SymbolChainTrace};
6
7#[path = "trace_chain_impl.rs"]
8mod trace_chain_impl;
9
10pub fn trace_symbol_chain_with_session(
17 session: &AnalysisSession,
18 query: SymbolChainQuery<'_>,
19) -> EngineResult<Option<SymbolChainTrace>> {
20 let output = session.analyze_dead_code_with_shared_artifacts(true, true)?;
21 let graph = output
22 .graph
23 .as_ref()
24 .ok_or_else(|| EngineError::new("trace requires a retained module graph"))?;
25 let modules = output.modules.as_deref().unwrap_or(&[]);
26 Ok(trace_chain_impl::trace_symbol_chain(
27 graph.as_graph(),
28 modules,
29 session.root(),
30 query,
31 ))
32}