(&mut self, node: Node<'t>, depth: u32)
| 909 | } |
| 910 | |
| 911 | fn scan_fn_ref_subtree(&mut self, node: Node<'t>, depth: u32) { |
| 912 | stack_guard!(); |
| 913 | if depth > 12 { |
| 914 | return; |
| 915 | } |
| 916 | // Halt at nested function definitions (their bodies are walked — and |
| 917 | // attributed — by extractFunction). Lua function_definition values are |
| 918 | // now extracted from their assignment target and must stop this scan too. |
| 919 | if depth > 0 |
| 920 | && matches!( |
| 921 | node.kind(), |
| 922 | "function_declaration" | "function_definition" | "arrow_function" | "function_expression" |
| 923 | | "lambda_literal" | "lambda_expression" |
| 924 | ) |
| 925 | { |
| 926 | return; |
| 927 | } |
| 928 | self.maybe_capture_fn_refs(node); |
| 929 | let mut cursor = node.walk(); |
| 930 | let children: Vec<Node<'t>> = node.named_children(&mut cursor).collect(); |
| 931 | for c in children { |
| 932 | self.scan_fn_ref_subtree(c, depth + 1); |
| 933 | } |
| 934 | } |
| 935 | |
| 936 | fn flush_fn_ref_candidates(&mut self) { |
| 937 | let cands = std::mem::take(&mut self.fn_ref_cands); |
no test coverage detected