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

Method extract_variable

codegraph-kernel/src/rustlang.rs:663–684  ·  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

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

Callers 1

visit_nodeMethod · 0.45

Calls 3

preceding_docstringFunction · 0.85
textMethod · 0.65
create_nodeMethod · 0.45

Tested by

no test coverage detected