(&mut self, node: Node<'t>, depth: u32, walked: &[usize])
| 1564 | } |
| 1565 | |
| 1566 | fn scan_fn_ref_subtree(&mut self, node: Node<'t>, depth: u32, walked: &[usize]) { |
| 1567 | stack_guard!(); |
| 1568 | if depth > 12 { |
| 1569 | return; |
| 1570 | } |
| 1571 | // Subtrees the body walker has already been through. |
| 1572 | if walked.contains(&node.id()) { |
| 1573 | return; |
| 1574 | } |
| 1575 | // functionTypes is EMPTY for C#; the literal halt list applies — |
| 1576 | // lambda_expression IS C#'s lambda, so a lambda the scan reaches (a |
| 1577 | // top-level statement's) stops it; anonymous_method_expression is NOT |
| 1578 | // listed and scans through. Member initializers are walked instead. |
| 1579 | if depth > 0 |
| 1580 | && matches!( |
| 1581 | node.kind(), |
| 1582 | "arrow_function" | "function_expression" | "lambda_literal" | "lambda_expression" |
| 1583 | ) |
| 1584 | { |
| 1585 | return; |
| 1586 | } |
| 1587 | self.maybe_capture_fn_refs(node); |
| 1588 | for i in 0..node.named_child_count() { |
| 1589 | if let Some(c) = node.named_child(i) { |
| 1590 | self.scan_fn_ref_subtree(c, depth + 1, walked); |
| 1591 | } |
| 1592 | } |
| 1593 | } |
| 1594 | |
| 1595 | fn flush_fn_ref_candidates(&mut self) { |
| 1596 | let cands = std::mem::take(&mut self.fn_ref_cands); |
no test coverage detected