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

Method extract_enum

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

Source from the content-addressed store, hash-verified

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

Callers 2

visit_nodeMethod · 0.45

Calls 9

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

Tested by

no test coverage detected