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

Method visit_body

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

Source from the content-addressed store, hash-verified

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

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