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

Method extract_aggregate

codegraph-kernel/src/ccpp/mod.rs:1414–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

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

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
walkMethod · 0.45
visit_nodeMethod · 0.45

Tested by

no test coverage detected