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

Method scan_fn_ref_subtree

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

Source from the content-addressed store, hash-verified

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