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

Method add_function

rust-core/src/codegraph/graph.rs:36–58  ·  view source on GitHub ↗

添加函数

(&mut self, function: FunctionInfo)

Source from the content-addressed store, hash-verified

34
35 /// 添加函数
36 pub fn add_function(&mut self, function: FunctionInfo) {
37 let id = function.id;
38 let name = function.name.clone();
39 let file_path = function.file_path.clone();
40 let language = function.language.clone();
41
42 // 添加到函数映射
43 self.functions.insert(id, function);
44
45 // 添加到函数名映射
46 self.function_names.entry(name.clone()).or_default().push(id);
47
48 // 添加到文件映射
49 self.file_functions.entry(file_path).or_default().push(id);
50
51 // 更新统计信息
52 self.stats.total_functions += 1;
53 *self.stats.languages.entry(language).or_default() += 1;
54
55 // 更新文件统计
56 self.stats.total_files = self.file_functions.len();
57 self.stats.total_languages = self.stats.languages.len();
58 }
59
60 /// 添加调用关系
61 pub fn add_call_relation(&mut self, relation: CallRelation) {

Callers 15

mainFunction · 0.45
refresh_fileMethod · 0.45
build_code_graphMethod · 0.45
_merge_new_functionsMethod · 0.45
to_petgraphMethod · 0.45
_update_fileMethod · 0.45

Calls 1

insertMethod · 0.80