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

Method extract_inheritance

codegraph-kernel/src/csharp.rs:1292–1316  ·  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

1290 /// emits one `extends` ref (interfaces conflated by design; the garbage
1291 /// `(repo)` argument-list / `BaseDto(Name)` / `: byte` shapes preserved).
1292 fn extract_inheritance(&mut self, node: Node<'t>, class_row: u32) {
1293 let extends_kind = edge_kind_index("extends").unwrap();
1294 for i in 0..node.named_child_count() {
1295 let Some(child) = node.named_child(i) else { continue };
1296 if child.kind() != "base_list" {
1297 continue;
1298 }
1299 for j in 0..child.named_child_count() {
1300 let Some(base) = child.named_child(j) else { continue };
1301 let name = if base.kind() == "generic_name" {
1302 // `ClientBase<T>` → head identifier; position = generic_name.
1303 let ident = (0..base.named_child_count())
1304 .filter_map(|k| base.named_child(k))
1305 .find(|c| c.kind() == "identifier");
1306 match ident {
1307 Some(idn) => self.text(idn).to_string(),
1308 None => self.text(base).to_string(),
1309 }
1310 } else {
1311 self.text(base).to_string()
1312 };
1313 self.push_ref_at(class_row, &name, extends_kind, base);
1314 }
1315 }
1316 }
1317
1318 // --- C# type-reference engine (extractCsharpTypeRefs, 5893) -----------------
1319

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
textMethod · 0.65
unwrapMethod · 0.60
push_ref_atMethod · 0.45

Tested by

no test coverage detected