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

Method _resolve_callee_function

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

解析被调用函数

(
        &self,
        call_name: &str,
        _current_file: &PathBuf,
        current_functions: &[FunctionInfo],
        code_graph: &PetCodeGraph,
    )

Source from the content-addressed store, hash-verified

1278
1279 /// 解析被调用函数
1280 fn _resolve_callee_function(
1281 &self,
1282 call_name: &str,
1283 _current_file: &PathBuf,
1284 current_functions: &[FunctionInfo],
1285 code_graph: &PetCodeGraph,
1286 ) -> Option<FunctionInfo> {
1287 // 1. 先在本文件查找
1288 for function in current_functions {
1289 if function.name == call_name {
1290 return Some(function.clone());
1291 }
1292 }
1293
1294 // 2. 在全局函数注册表中查找
1295 if let Some(global_func) = self._find_function_by_name_global(call_name) {
1296 return Some(global_func);
1297 }
1298
1299 // 3. 在代码图中查找
1300 let global_functions = code_graph.find_functions_by_name(call_name);
1301 if let Some(func) = global_functions.first() {
1302 return Some((*func).clone());
1303 }
1304
1305 // 4. 尝试解析限定名(如 Class.method, module.function)
1306 if let Some(qualified_func) = self._resolve_qualified_function_name(call_name, code_graph) {
1307 return Some(qualified_func);
1308 }
1309
1310 None
1311 }
1312
1313 /// 解析限定函数名(如 Class.method, module.function)
1314 fn _resolve_qualified_function_name(

Callers 1

Tested by

no test coverage detected