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

Method extract_enum

codegraph-kernel/src/ccpp/mod.rs:1438–1459  ·  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 i in 0..body.named_child_count() {
1451 let Some(child) = body.named_child(i) else { continue };
1452 if child.kind() == "enumerator" {
1453 self.extract_enum_members(child);
1454 } else {
1455 self.visit_node(child);
1456 }
1457 }
1458 self.stack.pop();
1459 }
1460
1461 /// extractEnumMembers: enumerator's `name` field (C/C++ always has one;
1462 /// 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