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

Method extract_aggregate

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

980
981 /// Extract a struct-like declaration while preserving its semantic kind.
982 fn extract_aggregate(&mut self, node: Node<'t>, kind: &'static str) {
983 stack_guard!();
984 let Some(body) = node.child_by_field_name("body") else { return };
985 let name = self.extract_name(node);
986 let extra = Extra {
987 docstring: preceding_docstring(node, self.src),
988 visibility: if self.variant == Variant::Cpp { self.visibility_of(node) } else { None },
989 ..Extra::default()
990 };
991 let Some(row) = self.create_node(kind, &name, node, extra) else { return };
992 self.extract_inheritance(node, row);
993 self.stack.push(Scope { row, kind, name });
994 for i in 0..body.named_child_count() {
995 if let Some(c) = body.named_child(i) {
996 self.visit_node(c);
997 }
998 }
999 self.stack.pop();
1000 }
1001
1002 fn extract_enum(&mut self, node: Node<'t>) {
1003 stack_guard!();

Callers 2

visit_nodeMethod · 0.45

Calls 6

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