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

Method scan_fn_ref_subtree

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

Source from the content-addressed store, hash-verified

1533 }
1534
1535 fn scan_fn_ref_subtree(&mut self, node: Node<'t>, depth: u32, walked: &HashSet<usize>) {
1536 stack_guard!();
1537 if depth > 12 {
1538 return;
1539 }
1540 // Subtrees the body walker has already been through.
1541 if walked.contains(&node.id()) {
1542 return;
1543 }
1544 // functionTypes is EMPTY for C#; the literal halt list applies —
1545 // lambda_expression IS C#'s lambda, so a lambda the scan reaches (a
1546 // top-level statement's) stops it; anonymous_method_expression is NOT
1547 // listed and scans through. Member initializers are walked instead.
1548 if depth > 0
1549 && matches!(
1550 node.kind(),
1551 "arrow_function" | "function_expression" | "lambda_literal" | "lambda_expression"
1552 )
1553 {
1554 return;
1555 }
1556 self.maybe_capture_fn_refs(node);
1557 for c in node.named_children(&mut node.walk()) {
1558 self.scan_fn_ref_subtree(c, depth + 1, walked);
1559 }
1560 }
1561
1562 fn flush_fn_ref_candidates(&mut self) {
1563 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