(&mut self, node: Node<'t>, depth: u32)
| 780 | } |
| 781 | |
| 782 | fn scan_fn_ref_subtree(&mut self, node: Node<'t>, depth: u32) { |
| 783 | if depth > 12 { |
| 784 | return; |
| 785 | } |
| 786 | // Halt at nested function definitions (their bodies are walked — and |
| 787 | // attributed — by extractFunction). function_definition (anonymous) |
| 788 | // is deliberately NOT in the halt list — the scan descends into |
| 789 | // anonymous initializer bodies, attributing candidates to the file. |
| 790 | if depth > 0 |
| 791 | && matches!( |
| 792 | node.kind(), |
| 793 | "function_declaration" | "arrow_function" | "function_expression" |
| 794 | | "lambda_literal" | "lambda_expression" |
| 795 | ) |
| 796 | { |
| 797 | return; |
| 798 | } |
| 799 | self.maybe_capture_fn_refs(node); |
| 800 | let mut cursor = node.walk(); |
| 801 | let children: Vec<Node<'t>> = node.named_children(&mut cursor).collect(); |
| 802 | for c in children { |
| 803 | self.scan_fn_ref_subtree(c, depth + 1); |
| 804 | } |
| 805 | } |
| 806 | |
| 807 | fn flush_fn_ref_candidates(&mut self) { |
| 808 | let cands = std::mem::take(&mut self.fn_ref_cands); |
no test coverage detected