scanFnRefSubtree: capture-only walk of subtrees the main walkers skip. `walked`: subtrees a body walk has already been through.
(&mut self, node: Node<'t>, depth: u32, walked: Option<&HashSet<usize>>)
| 618 | /// scanFnRefSubtree: capture-only walk of subtrees the main walkers skip. |
| 619 | /// `walked`: subtrees a body walk has already been through. |
| 620 | fn scan_fn_ref_subtree(&mut self, node: Node<'t>, depth: u32, walked: Option<&HashSet<usize>>) { |
| 621 | stack_guard!(); |
| 622 | if depth > 12 { |
| 623 | return; |
| 624 | } |
| 625 | if walked.map(|w| w.contains(&node.id())).unwrap_or(false) { |
| 626 | return; |
| 627 | } |
| 628 | let kind = node.kind(); |
| 629 | if depth > 0 |
| 630 | && (is_function_type(kind) || matches!(kind, "lambda_literal" | "lambda_expression")) |
| 631 | { |
| 632 | return; |
| 633 | } |
| 634 | self.maybe_capture_fn_refs(node); |
| 635 | for i in 0..node.named_child_count() { |
| 636 | if let Some(c) = node.named_child(i) { |
| 637 | self.scan_fn_ref_subtree(c, depth + 1, walked); |
| 638 | } |
| 639 | } |
| 640 | } |
| 641 | |
| 642 | fn flush_fn_ref_candidates(&mut self) { |
| 643 | let cands = std::mem::take(&mut self.fn_ref_cands); |
no test coverage detected