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

Method extract_enum

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

Source from the content-addressed store, hash-verified

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

Callers 2

dispatch_nodeMethod · 0.45

Calls 8

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