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

Method scan_fn_ref_subtree

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

Source from the content-addressed store, hash-verified

1742 }
1743
1744 fn scan_fn_ref_subtree(&mut self, node: Node<'t>, depth: u32, walked: &HashSet<usize>) {
1745 stack_guard!();
1746 if depth > 12 {
1747 return;
1748 }
1749 // Subtrees the body walker has already been through.
1750 if walked.contains(&node.id()) {
1751 return;
1752 }
1753 // Halts at functionTypes (function_declaration) + the fixed list —
1754 // lambda_literal halts (no captures inside `by lazy { }` under a
1755 // hook-consumed property).
1756 if depth > 0
1757 && matches!(
1758 node.kind(),
1759 "function_declaration" | "arrow_function" | "function_expression" | "lambda_literal"
1760 | "lambda_expression"
1761 )
1762 {
1763 return;
1764 }
1765 self.maybe_capture_fn_refs(node);
1766 for c in node.named_children(&mut node.walk()) {
1767 self.scan_fn_ref_subtree(c, depth + 1, walked);
1768 }
1769 }
1770
1771 fn flush_fn_ref_candidates(&mut self) {
1772 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