(&mut self, node: Node<'t>, depth: u32)
| 946 | } |
| 947 | |
| 948 | fn scan_fn_ref_subtree(&mut self, node: Node<'t>, depth: u32) { |
| 949 | stack_guard!(); |
| 950 | if depth > 12 { |
| 951 | return; |
| 952 | } |
| 953 | // Halts at functionTypes (`method`) + the fixed arrow/lambda list; |
| 954 | // NOT at class/module nodes — the module multiply-capture rides this. |
| 955 | if depth > 0 |
| 956 | && matches!( |
| 957 | node.kind(), |
| 958 | "method" | "arrow_function" | "function_expression" | "lambda_literal" |
| 959 | | "lambda_expression" |
| 960 | ) |
| 961 | { |
| 962 | return; |
| 963 | } |
| 964 | self.maybe_capture_fn_refs(node); |
| 965 | for i in 0..node.named_child_count() { |
| 966 | if let Some(c) = node.named_child(i) { |
| 967 | self.scan_fn_ref_subtree(c, depth + 1); |
| 968 | } |
| 969 | } |
| 970 | } |
| 971 | |
| 972 | fn flush_fn_ref_candidates(&mut self) { |
| 973 | let cands = std::mem::take(&mut self.fn_ref_cands); |
no test coverage detected