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

Method walk_tree_for_calls

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

Source from the content-addressed store, hash-verified

354 }
355
356 fn walk_tree_for_calls(
357 &self,
358 node: &Node,
359 source: &str,
360 file_path: &str,
361 refs: &mut Vec<Reference>,
362 ) {
363 if node.kind() == "call" {
364 if let Some(func_node) = node.child_by_field_name("function") {
365 if let Some(name) = self.extract_call_name(&func_node, source) {
366 if !name.is_empty() {
367 refs.push(Reference {
368 symbol: name,
369 file: file_path.to_string(),
370 line: (node.start_position().row as u32) + 1,
371 column: Some(node.start_position().column as u32),
372 context: None,
373 confidence: Confidence::High,
374 });
375 }
376 }
377 }
378 }
379
380 let mut cursor = node.walk();
381 for child in node.children(&mut cursor) {
382 self.walk_tree_for_calls(&child, source, file_path, refs);
383 }
384 }
385
386 fn extract_call_name(&self, func_node: &Node, source: &str) -> Option<String> {
387 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