(
&self,
node: &Node,
source: &str,
file_path: &str,
refs: &mut Vec<Reference>,
)
| 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() { |
no test coverage detected