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

Method extract_enum

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

Source from the content-addressed store, hash-verified

774 }
775
776 fn extract_enum(&mut self, node: Node<'t>) {
777 stack_guard!();
778 let Some(body) = node.child_by_field_name("body") else { return };
779 let name = self.extract_name(node);
780 let extra = Extra {
781 docstring: preceding_docstring(node, self.src),
782 visibility: Some(self.visibility_of(node)),
783 ..Extra::default()
784 };
785 let Some(row) = self.create_node("enum", &name, node, extra) else { return };
786 // The underlying type (`enum ReadType : byte`) sits in base_list →
787 // an `extends` ref named `byte` (garbage, PRESERVE).
788 self.extract_inheritance(node, row);
789 self.stack.push(Scope { row, kind: "enum", name });
790 for i in 0..body.named_child_count() {
791 let Some(child) = body.named_child(i) else { continue };
792 if child.kind() == "enum_member_declaration" {
793 self.extract_enum_members(child);
794 } else {
795 self.visit_node(child);
796 }
797 }
798 self.stack.pop();
799 }
800
801 fn extract_enum_members(&mut self, node: Node<'t>) {
802 // name-field path: one enum_member node positioned at the MEMBER node

Callers 2

visit_nodeMethod · 0.45

Calls 8

preceding_docstringFunction · 0.85
pushMethod · 0.80
extract_nameMethod · 0.45
visibility_ofMethod · 0.45
create_nodeMethod · 0.45
extract_inheritanceMethod · 0.45
extract_enum_membersMethod · 0.45
visit_nodeMethod · 0.45

Tested by

no test coverage detected