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

Method extract_enum

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

Source from the content-addressed store, hash-verified

1161 }
1162
1163 fn extract_enum(&mut self, node: Node<'t>) {
1164 stack_guard!();
1165 let Some(body) = node.child_by_field_name("body") else { return };
1166 let name = self.extract_name(node);
1167 let extra = Extra {
1168 docstring: preceding_docstring(node, self.src),
1169 visibility: if self.variant == Variant::Cpp { self.visibility_of(node) } else { None },
1170 ..Extra::default()
1171 };
1172 let Some(row) = self.create_node("enum", &name, node, extra) else { return };
1173 self.extract_inheritance(node, row);
1174 self.stack.push(Scope { row, kind: "enum", name });
1175 for i in 0..body.named_child_count() {
1176 let Some(child) = body.named_child(i) else { continue };
1177 if child.kind() == "enumerator" {
1178 self.extract_enum_members(child);
1179 } else {
1180 self.visit_node(child);
1181 }
1182 }
1183 self.stack.pop();
1184 }
1185
1186 /// extractEnumMembers: enumerator's `name` field (C/C++ always has one;
1187 /// the TS fallbacks for other grammars are unreachable here).

Callers 2

visit_nodeMethod · 0.45

Calls 8

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