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

Method extract_aggregate

codegraph-kernel/src/ccpp/mod.rs:1412–1436  ·  view source on GitHub ↗

Extract a struct-like declaration while preserving its semantic kind.

(&mut self, node: Node<'t>, kind: &'static str)

Source from the content-addressed store, hash-verified

1410
1411 /// Extract a struct-like declaration while preserving its semantic kind.
1412 fn extract_aggregate(&mut self, node: Node<'t>, kind: &'static str) {
1413 stack_guard!();
1414 let Some(body) = node.child_by_field_name("body") else { return };
1415 let name = self.extract_name(node);
1416 let scoped = self.written_scope_qualified_name(node, &name);
1417 let extra = Extra {
1418 docstring: self.class_like_docstring(node),
1419 visibility: if self.variant == Variant::Cpp { self.visibility_of(node) } else { None },
1420 end: self.brace_body_end(body),
1421 qualified_name: scoped.clone(),
1422 ..Extra::default()
1423 };
1424 let Some(row) = self.create_node(kind, &name, node, extra) else { return };
1425 let scope = Scope { row, kind, name, qualified: scoped };
1426 self.open_class_scope(&scope, body);
1427 self.extract_inheritance(node, row);
1428 self.push_member_type_refs(node, row, &scope.name);
1429 self.stack.push(scope);
1430 for i in 0..body.named_child_count() {
1431 if let Some(c) = body.named_child(i) {
1432 self.visit_node(c);
1433 }
1434 }
1435 self.stack.pop();
1436 }
1437
1438 fn extract_enum(&mut self, node: Node<'t>) {
1439 stack_guard!();

Callers 2

dispatch_nodeMethod · 0.45

Calls 11

class_like_docstringMethod · 0.80
brace_body_endMethod · 0.80
open_class_scopeMethod · 0.80
push_member_type_refsMethod · 0.80
pushMethod · 0.80
extract_nameMethod · 0.45
visibility_ofMethod · 0.45
create_nodeMethod · 0.45
extract_inheritanceMethod · 0.45
visit_nodeMethod · 0.45

Tested by

no test coverage detected