MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / walk_tree_for_calls

Method walk_tree_for_calls

atomic-semantic/src/parsers/cpp.rs:698–726  ·  view source on GitHub ↗
(
        &self,
        node: &Node,
        source: &str,
        file_path: &str,
        refs: &mut Vec<Reference>,
    )

Source from the content-addressed store, hash-verified

696 }
697
698 fn walk_tree_for_calls(
699 &self,
700 node: &Node,
701 source: &str,
702 file_path: &str,
703 refs: &mut Vec<Reference>,
704 ) {
705 if node.kind() == "call_expression" {
706 if let Some(func_node) = node.child_by_field_name("function") {
707 if let Some(name) = self.extract_call_name(&func_node, source) {
708 if !name.is_empty() {
709 refs.push(Reference {
710 symbol: name,
711 file: file_path.to_string(),
712 line: (node.start_position().row as u32) + 1,
713 column: Some(node.start_position().column as u32),
714 context: None,
715 confidence: Confidence::High,
716 });
717 }
718 }
719 }
720 }
721
722 let mut cursor = node.walk();
723 for child in node.children(&mut cursor) {
724 self.walk_tree_for_calls(&child, source, file_path, refs);
725 }
726 }
727
728 fn extract_call_name(&self, func_node: &Node, source: &str) -> Option<String> {
729 match func_node.kind() {

Callers 1

extract_referencesMethod · 0.45

Calls 6

walkMethod · 0.80
childrenMethod · 0.80
kindMethod · 0.45
extract_call_nameMethod · 0.45
is_emptyMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected