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

Method scan_fn_ref_subtree

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

Source from the content-addressed store, hash-verified

1720 }
1721
1722 fn scan_fn_ref_subtree(&mut self, node: Node<'t>, depth: u32, walked: &[usize]) {
1723 stack_guard!();
1724 if depth > 12 {
1725 return;
1726 }
1727 // Subtrees the body walker has already been through.
1728 if walked.contains(&node.id()) {
1729 return;
1730 }
1731 // Halts at functionTypes (function_declaration) + the fixed list —
1732 // lambda_literal halts (no captures inside `by lazy { }` under a
1733 // hook-consumed property).
1734 if depth > 0
1735 && matches!(
1736 node.kind(),
1737 "function_declaration" | "arrow_function" | "function_expression" | "lambda_literal"
1738 | "lambda_expression"
1739 )
1740 {
1741 return;
1742 }
1743 self.maybe_capture_fn_refs(node);
1744 for i in 0..node.named_child_count() {
1745 if let Some(c) = node.named_child(i) {
1746 self.scan_fn_ref_subtree(c, depth + 1, walked);
1747 }
1748 }
1749 }
1750
1751 fn flush_fn_ref_candidates(&mut self) {
1752 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