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

Method extract_inheritance

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

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

Callers 4

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

Calls 5

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

Tested by

no test coverage detected