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

Method extract_variable

codegraph-kernel/src/rustlang.rs:651–672  ·  view source on GitHub ↗

extractVariable's generic fallback: kind is ALWAYS `variable` (no isConst hook), every direct `identifier` child mints a node positioned at the CHILD, docstring shared, isExported present-false, no signature, and the initializer value is never body-walked.

(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

649 /// at the CHILD, docstring shared, isExported present-false, no signature,
650 /// and the initializer value is never body-walked.
651 fn extract_variable(&mut self, node: Node<'t>) {
652 let docstring = preceding_docstring(node, self.src);
653 for i in 0..node.named_child_count() {
654 let Some(child) = node.named_child(i) else { continue };
655 if child.kind() != "identifier" {
656 continue;
657 }
658 let name = self.text(child).to_string();
659 if !name.is_empty() {
660 self.create_node(
661 "variable",
662 &name,
663 child,
664 Extra {
665 docstring: docstring.clone(),
666 is_exported: Some(false),
667 ..Extra::default()
668 },
669 );
670 }
671 }
672 }
673
674 /// extractImport via the rust hook: import node named by the ROOT module +
675 /// one generic root `imports` ref + per-binding FULL-path refs.

Callers 1

visit_nodeMethod · 0.45

Calls 3

preceding_docstringFunction · 0.85
textMethod · 0.45
create_nodeMethod · 0.45

Tested by

no test coverage detected