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