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

Method extract_inheritance

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

1306 /// emits one `extends` ref (interfaces conflated by design; the garbage
1307 /// `(repo)` argument-list / `BaseDto(Name)` / `: byte` shapes preserved).
1308 fn extract_inheritance(&mut self, node: Node<'t>, class_row: u32) {
1309 let extends_kind = edge_kind_index("extends").unwrap();
1310 for i in 0..node.named_child_count() {
1311 let Some(child) = node.named_child(i) else { continue };
1312 if child.kind() != "base_list" {
1313 continue;
1314 }
1315 for j in 0..child.named_child_count() {
1316 let Some(base) = child.named_child(j) else { continue };
1317 let name = if base.kind() == "generic_name" {
1318 // `ClientBase<T>` → head identifier; position = generic_name.
1319 let ident = (0..base.named_child_count())
1320 .filter_map(|k| base.named_child(k))
1321 .find(|c| c.kind() == "identifier");
1322 match ident {
1323 Some(idn) => self.text(idn).to_string(),
1324 None => self.text(base).to_string(),
1325 }
1326 } else {
1327 self.text(base).to_string()
1328 };
1329 self.push_ref_at(class_row, &name, extends_kind, base);
1330 }
1331 }
1332 }
1333
1334 // --- C# type-reference engine (extractCsharpTypeRefs, 5893) -----------------
1335

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