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

Method extract_enum

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

Source from the content-addressed store, hash-verified

1436 }
1437
1438 fn extract_enum(&mut self, node: Node<'t>) {
1439 stack_guard!();
1440 let Some(body) = node.child_by_field_name("body") else { return };
1441 let name = self.extract_name(node);
1442 let extra = Extra {
1443 docstring: self.class_like_docstring(node),
1444 visibility: if self.variant == Variant::Cpp { self.visibility_of(node) } else { None },
1445 ..Extra::default()
1446 };
1447 let Some(row) = self.create_node("enum", &name, node, extra) else { return };
1448 self.extract_inheritance(node, row);
1449 self.stack.push(Scope { row, kind: "enum", name, qualified: None });
1450 for child in body.named_children(&mut body.walk()) {
1451 if child.kind() == "enumerator" {
1452 self.extract_enum_members(child);
1453 } else {
1454 self.visit_node(child);
1455 }
1456 }
1457 self.stack.pop();
1458 }
1459
1460 /// extractEnumMembers: enumerator's `name` field (C/C++ always has one;
1461 /// the TS fallbacks for other grammars are unreachable here).

Callers 2

dispatch_nodeMethod · 0.45

Calls 9

class_like_docstringMethod · 0.80
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