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

Method scan_fn_ref_subtree

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

Source from the content-addressed store, hash-verified

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