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>>)
| 637 | /// scanFnRefSubtree: capture-only walk of subtrees the main walkers skip. |
| 638 | /// `walked`: subtrees a body walk has already been through. |
| 639 | fn scan_fn_ref_subtree(&mut self, node: Node<'t>, depth: u32, walked: Option<&HashSet<usize>>) { |
| 640 | stack_guard!(); |
| 641 | if depth > 12 { |
| 642 | return; |
| 643 | } |
| 644 | if walked.map(|w| w.contains(&node.id())).unwrap_or(false) { |
| 645 | return; |
| 646 | } |
| 647 | let kind = node.kind(); |
| 648 | if depth > 0 |
| 649 | && (is_function_type(kind) || matches!(kind, "lambda_literal" | "lambda_expression")) |
| 650 | { |
| 651 | return; |
| 652 | } |
| 653 | self.maybe_capture_fn_refs(node); |
| 654 | for i in 0..node.named_child_count() { |
| 655 | if let Some(c) = node.named_child(i) { |
| 656 | self.scan_fn_ref_subtree(c, depth + 1, walked); |
| 657 | } |
| 658 | } |
| 659 | } |
| 660 | |
| 661 | fn flush_fn_ref_candidates(&mut self) { |
| 662 | let cands = std::mem::take(&mut self.fn_ref_cands); |
no test coverage detected