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

Method extract_inheritance

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

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

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