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

Method visit_body

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

Source from the content-addressed store, hash-verified

779 // --- visitFunctionBody (5129-5286) — the hook-free body walk ----------
780
781 fn visit_body(&mut self, node: Node<'t>) {
782 stack_guard!();
783 // maybeCaptureFnRefs (5137) fires in the body walker too.
784 self.maybe_capture_fn_refs(node);
785
786 let kind = node.kind();
787 if kind == "function_call" {
788 // The hook NEVER runs here — a body-level require emits
789 // `calls "require"` (the neovim lazy-loading idiom).
790 self.extract_call(node);
791 // falls through to recursion — chains emit every link
792 } else if kind == "function_declaration" {
793 // Nested NAMED functions (5245-5250): extractFunction walks the
794 // nested body itself, so return. extractName is never
795 // `<anonymous>` for function_declaration.
796 self.extract_function(node);
797 return;
798 }
799 // variable_declaration / type_definition have NO branch here → plain
800 // recursion: body-local initializers ARE walked (calls emit), no
801 // variable/type_alias nodes minted.
802
803 let mut cursor = node.walk();
804 let children: Vec<Node<'t>> = node.named_children(&mut cursor).collect();
805 for child in children {
806 self.visit_body(child);
807 }
808 }
809
810 // --- function-as-value capture (#756) — LUA_SPEC ----------------------
811

Callers 3

extract_functionMethod · 0.45
extract_methodMethod · 0.45

Calls 5

walkMethod · 0.80
maybe_capture_fn_refsMethod · 0.45
extract_callMethod · 0.45
extract_functionMethod · 0.45
collectMethod · 0.45

Tested by

no test coverage detected