(&mut self, node: Node<'t>, depth: u32, walked: &HashSet<usize>)
| 1271 | } |
| 1272 | |
| 1273 | fn scan_fn_ref_subtree(&mut self, node: Node<'t>, depth: u32, walked: &HashSet<usize>) { |
| 1274 | stack_guard!(); |
| 1275 | if depth > 12 { |
| 1276 | return; |
| 1277 | } |
| 1278 | // Subtrees the body walker has already been through. A set: looked up |
| 1279 | // for every node of the subtree, the list of a `const (…)` block of some |
| 1280 | // thousand names was read through each time. |
| 1281 | if walked.contains(&node.id()) { |
| 1282 | return; |
| 1283 | } |
| 1284 | if depth > 0 |
| 1285 | && matches!( |
| 1286 | node.kind(), |
| 1287 | "function_declaration" | "arrow_function" | "function_expression" |
| 1288 | | "lambda_literal" | "lambda_expression" |
| 1289 | ) |
| 1290 | { |
| 1291 | return; |
| 1292 | } |
| 1293 | self.maybe_capture_fn_refs(node); |
| 1294 | for c in node.named_children(&mut node.walk()) { |
| 1295 | self.scan_fn_ref_subtree(c, depth + 1, walked); |
| 1296 | } |
| 1297 | } |
| 1298 | |
| 1299 | fn flush_fn_ref_candidates(&mut self) { |
| 1300 | let cands = std::mem::take(&mut self.fn_ref_cands); |
no test coverage detected