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

Method extract_enum

codegraph-kernel/src/ccpp/mod.rs:994–1014  ·  view source on GitHub ↗
(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

992 }
993
994 fn extract_enum(&mut self, node: Node<'t>) {
995 let Some(body) = node.child_by_field_name("body") else { return };
996 let name = self.extract_name(node);
997 let extra = Extra {
998 docstring: preceding_docstring(node, self.src),
999 visibility: if self.variant == Variant::Cpp { self.visibility_of(node) } else { None },
1000 ..Extra::default()
1001 };
1002 let Some(row) = self.create_node("enum", &name, node, extra) else { return };
1003 self.extract_inheritance(node, row);
1004 self.stack.push(Scope { row, kind: "enum", name });
1005 for i in 0..body.named_child_count() {
1006 let Some(child) = body.named_child(i) else { continue };
1007 if child.kind() == "enumerator" {
1008 self.extract_enum_members(child);
1009 } else {
1010 self.visit_node(child);
1011 }
1012 }
1013 self.stack.pop();
1014 }
1015
1016 /// extractEnumMembers: enumerator's `name` field (C/C++ always has one;
1017 /// the TS fallbacks for other grammars are unreachable here).

Callers 2

visit_nodeMethod · 0.45

Calls 7

preceding_docstringFunction · 0.85
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