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

Method scan_fn_ref_subtree

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

Source from the content-addressed store, hash-verified

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