(&mut self, node: Node<'t>, depth: u32, walked: &[usize])
| 971 | } |
| 972 | |
| 973 | fn scan_fn_ref_subtree(&mut self, node: Node<'t>, depth: u32, walked: &[usize]) { |
| 974 | stack_guard!(); |
| 975 | if depth > 12 { |
| 976 | return; |
| 977 | } |
| 978 | // Subtrees the body walker has already been through. |
| 979 | if walked.contains(&node.id()) { |
| 980 | return; |
| 981 | } |
| 982 | // Halts at functionTypes ∪ the fixed arrow/lambda list — python's |
| 983 | // `lambda` kind is NOT in that list (mirrored). |
| 984 | if depth > 0 |
| 985 | && matches!( |
| 986 | node.kind(), |
| 987 | "function_definition" | "arrow_function" | "function_expression" | "lambda_literal" |
| 988 | | "lambda_expression" |
| 989 | ) |
| 990 | { |
| 991 | return; |
| 992 | } |
| 993 | self.maybe_capture_fn_refs(node); |
| 994 | for i in 0..node.named_child_count() { |
| 995 | if let Some(c) = node.named_child(i) { |
| 996 | self.scan_fn_ref_subtree(c, depth + 1, walked); |
| 997 | } |
| 998 | } |
| 999 | } |
| 1000 | |
| 1001 | fn flush_fn_ref_candidates(&mut self) { |
| 1002 | let cands = std::mem::take(&mut self.fn_ref_cands); |
no test coverage detected