(&mut self, node: Node<'t>, depth: u32, walked: &[usize])
| 1452 | } |
| 1453 | |
| 1454 | fn scan_fn_ref_subtree(&mut self, node: Node<'t>, depth: u32, walked: &[usize]) { |
| 1455 | stack_guard!(); |
| 1456 | if depth > 12 { |
| 1457 | return; |
| 1458 | } |
| 1459 | // Subtrees the body walker has already been through. |
| 1460 | if walked.contains(&node.id()) { |
| 1461 | return; |
| 1462 | } |
| 1463 | if depth > 0 |
| 1464 | && matches!( |
| 1465 | node.kind(), |
| 1466 | "function_item" | "function_signature_item" | "arrow_function" |
| 1467 | | "function_expression" | "lambda_literal" | "lambda_expression" |
| 1468 | ) |
| 1469 | { |
| 1470 | return; |
| 1471 | } |
| 1472 | self.maybe_capture_fn_refs(node); |
| 1473 | for i in 0..node.named_child_count() { |
| 1474 | if let Some(c) = node.named_child(i) { |
| 1475 | self.scan_fn_ref_subtree(c, depth + 1, walked); |
| 1476 | } |
| 1477 | } |
| 1478 | } |
| 1479 | |
| 1480 | fn flush_fn_ref_candidates(&mut self) { |
| 1481 | let cands = std::mem::take(&mut self.fn_ref_cands); |
no test coverage detected