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

Method extract_call_name

atomic-semantic/src/parsers/swift.rs:598–630  ·  view source on GitHub ↗
(&self, func_node: &Node, source: &str)

Source from the content-addressed store, hash-verified

596 }
597
598 fn extract_call_name(&self, func_node: &Node, source: &str) -> Option<String> {
599 match func_node.kind() {
600 "simple_identifier" => {
601 let name = self.node_text(func_node, source);
602 if name.is_empty() {
603 None
604 } else {
605 Some(name)
606 }
607 }
608 "navigation_expression" => {
609 // obj.method() — find the last navigation_suffix to get the method name
610 for i in (0..func_node.child_count()).rev() {
611 if let Some(suffix) = func_node.child(i) {
612 if suffix.kind() == "navigation_suffix" {
613 for j in 0..suffix.child_count() {
614 if let Some(name_node) = suffix.child(j) {
615 if name_node.kind() == "simple_identifier" {
616 let name = self.node_text(&name_node, source);
617 if !name.is_empty() {
618 return Some(name);
619 }
620 }
621 }
622 }
623 }
624 }
625 }
626 None
627 }
628 _ => None,
629 }
630 }
631}
632
633impl Default for SwiftParser {

Callers 1

walk_tree_for_callsMethod · 0.45

Calls 4

child_countMethod · 0.80
kindMethod · 0.45
node_textMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected