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

Method extract_inheritance

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

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

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