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

Method scan_fn_ref_subtree

codegraph-kernel/src/lua.rs:787–811  ·  view source on GitHub ↗
(&mut self, node: Node<'t>, depth: u32)

Source from the content-addressed store, hash-verified

785 }
786
787 fn scan_fn_ref_subtree(&mut self, node: Node<'t>, depth: u32) {
788 stack_guard!();
789 if depth > 12 {
790 return;
791 }
792 // Halt at nested function definitions (their bodies are walked — and
793 // attributed — by extractFunction). function_definition (anonymous)
794 // is deliberately NOT in the halt list — the scan descends into
795 // anonymous initializer bodies, attributing candidates to the file.
796 if depth > 0
797 && matches!(
798 node.kind(),
799 "function_declaration" | "arrow_function" | "function_expression"
800 | "lambda_literal" | "lambda_expression"
801 )
802 {
803 return;
804 }
805 self.maybe_capture_fn_refs(node);
806 let mut cursor = node.walk();
807 let children: Vec<Node<'t>> = node.named_children(&mut cursor).collect();
808 for c in children {
809 self.scan_fn_ref_subtree(c, depth + 1);
810 }
811 }
812
813 fn flush_fn_ref_candidates(&mut self) {
814 let cands = std::mem::take(&mut self.fn_ref_cands);

Callers 1

visitMethod · 0.45

Calls 2

maybe_capture_fn_refsMethod · 0.45
collectMethod · 0.45

Tested by

no test coverage detected