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

Method extract_inheritance

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

extractInheritance — the branches whose node kinds occur in the c/cpp grammars: base_class_clause (#1043) and the field_declaration_list recursion. A member `field_declaration` is never a supertype: the TS Go-embedding check is gated to Go, since c/cpp members nest their field_identifier inside a pointer/array/function declarator.

(&mut self, node: Node<'t>, class_row: u32)

Source from the content-addressed store, hash-verified

2150 /// Go-embedding check is gated to Go, since c/cpp members nest their
2151 /// field_identifier inside a pointer/array/function declarator.
2152 fn extract_inheritance(&mut self, node: Node<'t>, class_row: u32) {
2153 stack_guard!();
2154 let extends_kind = edge_kind_index("extends").unwrap();
2155 for i in 0..node.named_child_count() {
2156 let Some(child) = node.named_child(i) else { continue };
2157 match child.kind() {
2158 "base_class_clause" => {
2159 for j in 0..child.named_child_count() {
2160 let Some(t) = child.named_child(j) else { continue };
2161 if matches!(
2162 t.kind(),
2163 "type_identifier" | "qualified_identifier" | "template_type"
2164 ) {
2165 let name = strip_cpp_template_args(self.text(t));
2166 self.push_ref_at(class_row, &name, extends_kind, t);
2167 }
2168 }
2169 }
2170 "field_declaration_list" | "class_heritage" => {
2171 self.extract_inheritance(child, class_row);
2172 }
2173 _ => {}
2174 }
2175 }
2176 }
2177
2178 // --- the types members and aliases are declared with --------------------
2179

Callers 4

extract_classMethod · 0.45
extract_aggregateMethod · 0.45
extract_enumMethod · 0.45
extract_type_aliasMethod · 0.45

Calls 5

edge_kind_indexFunction · 0.85
strip_cpp_template_argsFunction · 0.85
textMethod · 0.65
unwrapMethod · 0.60
push_ref_atMethod · 0.45

Tested by

no test coverage detected