查找调用链
(&self, function_name: &str, max_depth: usize)
| 82 | |
| 83 | /// 查找调用链 |
| 84 | pub fn find_call_chains(&self, function_name: &str, max_depth: usize) -> Vec<Vec<&FunctionInfo>> { |
| 85 | if let Some(code_graph) = &self.code_graph { |
| 86 | if let Some(function) = code_graph.find_functions_by_name(function_name).first() { |
| 87 | let chains = code_graph.get_call_chain(&function.id, max_depth); |
| 88 | chains.into_iter().map(|chain| { |
| 89 | chain.iter().filter_map(|id| code_graph.functions.get(id)).collect() |
| 90 | }).collect() |
| 91 | } else { |
| 92 | Vec::new() |
| 93 | } |
| 94 | } else { |
| 95 | Vec::new() |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | /// 查找循环依赖 |
| 100 | pub fn find_circular_dependencies(&self) -> Vec<Vec<&FunctionInfo>> { |
nothing calls this directly
no test coverage detected