MCPcopy Create free account
hub / github.com/CodeBendKit/codeseek / _analyze_petgraph_call_relations

Method _analyze_petgraph_call_relations

rust-core/src/codegraph/parser.rs:1174–1210  ·  view source on GitHub ↗

分析petgraph调用关系(完整实现)

(&self, code_graph: &mut PetCodeGraph)

Source from the content-addressed store, hash-verified

1172
1173 /// 分析petgraph调用关系(完整实现)
1174 fn _analyze_petgraph_call_relations(&self, code_graph: &mut PetCodeGraph) {
1175 info!("Starting petgraph call relation analysis for {} files", self.file_functions.len());
1176
1177 let mut total_calls = 0;
1178 let mut resolved_calls = 0;
1179 let mut unresolved_calls = 0;
1180
1181 // 遍历每个文件的函数
1182 for (file_path, functions) in &self.file_functions {
1183 if functions.is_empty() {
1184 continue;
1185 }
1186
1187 // 使用TreeSitter解析器分析文件中的函数调用
1188 match self.ts_parser.parse_file(file_path) {
1189 Ok(symbols) => {
1190 let file_calls = self._analyze_file_calls_for_petgraph(
1191 &symbols,
1192 functions,
1193 code_graph,
1194 file_path
1195 );
1196 total_calls += file_calls.total;
1197 resolved_calls += file_calls.resolved;
1198 unresolved_calls += file_calls.unresolved;
1199 },
1200 Err(e) => {
1201 warn!("Failed to parse file {} for call analysis: {:?}", file_path.display(), e);
1202 // 即使解析失败,也尝试基于函数名的简单分析
1203 self._fallback_call_analysis(functions, code_graph);
1204 }
1205 }
1206 }
1207
1208 info!("Call analysis completed: {} total calls, {} resolved, {} unresolved",
1209 total_calls, resolved_calls, unresolved_calls);
1210 }
1211
1212 /// 分析单个文件的函数调用(用于petgraph)
1213 fn _analyze_file_calls_for_petgraph(

Calls 3

parse_fileMethod · 0.45

Tested by 1