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

Method scan_fn_ref_subtree

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

Source from the content-addressed store, hash-verified

1264 }
1265
1266 fn scan_fn_ref_subtree(&mut self, node: Node<'t>, depth: u32, walked: &[usize]) {
1267 stack_guard!();
1268 if depth > 12 {
1269 return;
1270 }
1271 // Subtrees the body walker has already been through.
1272 if walked.contains(&node.id()) {
1273 return;
1274 }
1275 if depth > 0
1276 && matches!(
1277 node.kind(),
1278 "function_declaration" | "arrow_function" | "function_expression"
1279 | "lambda_literal" | "lambda_expression"
1280 )
1281 {
1282 return;
1283 }
1284 self.maybe_capture_fn_refs(node);
1285 for i in 0..node.named_child_count() {
1286 if let Some(c) = node.named_child(i) {
1287 self.scan_fn_ref_subtree(c, depth + 1, walked);
1288 }
1289 }
1290 }
1291
1292 fn flush_fn_ref_candidates(&mut self) {
1293 let cands = std::mem::take(&mut self.fn_ref_cands);

Callers 1

visit_nodeMethod · 0.45

Calls 2

idMethod · 0.80
maybe_capture_fn_refsMethod · 0.45

Tested by

no test coverage detected