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

Method extract_aggregate

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

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