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

Method extract_inheritance

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

2139 /// Go-embedding check is gated to Go, since c/cpp members nest their
2140 /// field_identifier inside a pointer/array/function declarator.
2141 fn extract_inheritance(&mut self, node: Node<'t>, class_row: u32) {
2142 stack_guard!();
2143 let extends_kind = edge_kind_index("extends").unwrap();
2144 for child in node.named_children(&mut node.walk()) {
2145 match child.kind() {
2146 "base_class_clause" => {
2147 for t in child.named_children(&mut child.walk()) {
2148 if matches!(
2149 t.kind(),
2150 "type_identifier" | "qualified_identifier" | "template_type"
2151 ) {
2152 let name = strip_cpp_template_args(self.text(t));
2153 self.push_ref_at(class_row, &name, extends_kind, t);
2154 }
2155 }
2156 }
2157 "field_declaration_list" | "class_heritage" => {
2158 self.extract_inheritance(child, class_row);
2159 }
2160 _ => {}
2161 }
2162 }
2163 }
2164
2165 // --- the types members and aliases are declared with --------------------
2166

Callers 4

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

Calls 6

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

Tested by

no test coverage detected