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

Method visit_body

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

Source from the content-addressed store, hash-verified

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

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