合并新解析的函数到现有图中
(&self, code_graph: &mut PetCodeGraph)
| 1001 | |
| 1002 | /// 合并新解析的函数到现有图中 |
| 1003 | fn _merge_new_functions(&self, code_graph: &mut PetCodeGraph) { |
| 1004 | for (_file_path, functions) in &self.file_functions { |
| 1005 | for function in functions { |
| 1006 | // 检查函数是否已存在(基于文件路径和行号) |
| 1007 | let exists = code_graph.graph.node_weights().any(|existing_func| { |
| 1008 | existing_func.file_path == function.file_path && |
| 1009 | existing_func.line_start == function.line_start && |
| 1010 | existing_func.line_end == function.line_end |
| 1011 | }); |
| 1012 | |
| 1013 | if !exists { |
| 1014 | code_graph.add_function(function.clone()); |
| 1015 | } |
| 1016 | } |
| 1017 | } |
| 1018 | } |
| 1019 | |
| 1020 | /// 分析调用关系 |
| 1021 | fn _analyze_call_relations(&self, code_graph: &mut CodeGraph) { |
no test coverage detected