(&self, func_node: &Node, source: &str)
| 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 | |
| 633 | impl Default for SwiftParser { |
no test coverage detected