MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / scan_fn_ref_subtree

Method scan_fn_ref_subtree

codegraph-kernel/src/go.rs:1273–1297  ·  view source on GitHub ↗
(&mut self, node: Node<'t>, depth: u32, walked: &HashSet<usize>)

Source from the content-addressed store, hash-verified

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);

Callers 1

visit_nodeMethod · 0.45

Calls 3

idMethod · 0.80
maybe_capture_fn_refsMethod · 0.45
walkMethod · 0.45

Tested by

no test coverage detected