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

Method scan_fn_ref_subtree

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

Source from the content-addressed store, hash-verified

909 }
910
911 fn scan_fn_ref_subtree(&mut self, node: Node<'t>, depth: u32) {
912 stack_guard!();
913 if depth > 12 {
914 return;
915 }
916 // Halt at nested function definitions (their bodies are walked — and
917 // attributed — by extractFunction). Lua function_definition values are
918 // now extracted from their assignment target and must stop this scan too.
919 if depth > 0
920 && matches!(
921 node.kind(),
922 "function_declaration" | "function_definition" | "arrow_function" | "function_expression"
923 | "lambda_literal" | "lambda_expression"
924 )
925 {
926 return;
927 }
928 self.maybe_capture_fn_refs(node);
929 let mut cursor = node.walk();
930 let children: Vec<Node<'t>> = node.named_children(&mut cursor).collect();
931 for c in children {
932 self.scan_fn_ref_subtree(c, depth + 1);
933 }
934 }
935
936 fn flush_fn_ref_candidates(&mut self) {
937 let cands = std::mem::take(&mut self.fn_ref_cands);

Callers 1

visitMethod · 0.45

Calls 3

walkMethod · 0.80
maybe_capture_fn_refsMethod · 0.45
collectMethod · 0.45

Tested by

no test coverage detected