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

Method visit_body

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

Source from the content-addressed store, hash-verified

654 // --- visitFunctionBody (5129-5286) — the hook-free body walk ----------
655
656 fn visit_body(&mut self, node: Node<'t>) {
657 // maybeCaptureFnRefs (5137) fires in the body walker too.
658 self.maybe_capture_fn_refs(node);
659
660 let kind = node.kind();
661 if kind == "function_call" {
662 // The hook NEVER runs here — a body-level require emits
663 // `calls "require"` (the neovim lazy-loading idiom).
664 self.extract_call(node);
665 // falls through to recursion — chains emit every link
666 } else if kind == "function_declaration" {
667 // Nested NAMED functions (5245-5250): extractFunction walks the
668 // nested body itself, so return. extractName is never
669 // `<anonymous>` for function_declaration.
670 self.extract_function(node);
671 return;
672 }
673 // variable_declaration / type_definition have NO branch here → plain
674 // recursion: body-local initializers ARE walked (calls emit), no
675 // variable/type_alias nodes minted.
676
677 let mut cursor = node.walk();
678 let children: Vec<Node<'t>> = node.named_children(&mut cursor).collect();
679 for child in children {
680 self.visit_body(child);
681 }
682 }
683
684 // --- function-as-value capture (#756) — LUA_SPEC ----------------------
685

Callers 2

extract_functionMethod · 0.45
extract_methodMethod · 0.45

Calls 4

maybe_capture_fn_refsMethod · 0.45
extract_callMethod · 0.45
extract_functionMethod · 0.45
collectMethod · 0.45

Tested by

no test coverage detected