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

Method extract_inheritance

codegraph-kernel/src/csharp.rs:1167–1191  ·  view source on GitHub ↗

extractInheritance — the C# base_list branch (5577): EVERY namedChild emits one `extends` ref (interfaces conflated by design; the garbage `(repo)` argument-list / `BaseDto(Name)` / `: byte` shapes preserved).

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

Source from the content-addressed store, hash-verified

1165 /// emits one `extends` ref (interfaces conflated by design; the garbage
1166 /// `(repo)` argument-list / `BaseDto(Name)` / `: byte` shapes preserved).
1167 fn extract_inheritance(&mut self, node: Node<'t>, class_row: u32) {
1168 let extends_kind = edge_kind_index("extends").unwrap();
1169 for i in 0..node.named_child_count() {
1170 let Some(child) = node.named_child(i) else { continue };
1171 if child.kind() != "base_list" {
1172 continue;
1173 }
1174 for j in 0..child.named_child_count() {
1175 let Some(base) = child.named_child(j) else { continue };
1176 let name = if base.kind() == "generic_name" {
1177 // `ClientBase<T>` → head identifier; position = generic_name.
1178 let ident = (0..base.named_child_count())
1179 .filter_map(|k| base.named_child(k))
1180 .find(|c| c.kind() == "identifier");
1181 match ident {
1182 Some(idn) => self.text(idn).to_string(),
1183 None => self.text(base).to_string(),
1184 }
1185 } else {
1186 self.text(base).to_string()
1187 };
1188 self.push_ref_at(class_row, &name, extends_kind, base);
1189 }
1190 }
1191 }
1192
1193 // --- C# type-reference engine (extractCsharpTypeRefs, 5893) -----------------
1194

Callers 4

extract_classMethod · 0.45
extract_structMethod · 0.45
extract_interfaceMethod · 0.45
extract_enumMethod · 0.45

Calls 4

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

Tested by

no test coverage detected