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