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

Method extract_inheritance

codegraph-kernel/src/swift.rs:1197–1214  ·  view source on GitHub ↗

extractInheritance — the swift inheritance_specifier case: FIRST type_identifier of each specifier's user_type, everything as `extends` (conformances included; `: Module.Base` takes `Module`).

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

Source from the content-addressed store, hash-verified

1195 /// type_identifier of each specifier's user_type, everything as `extends`
1196 /// (conformances included; `: Module.Base` takes `Module`).
1197 fn extract_inheritance(&mut self, node: Node<'t>, class_row: u32) {
1198 let extends_kind = edge_kind_index("extends").unwrap();
1199 for child in node.named_children(&mut node.walk()) {
1200 if child.kind() != "inheritance_specifier" {
1201 continue;
1202 }
1203 let user_type = (0..child.named_child_count())
1204 .filter_map(|j| child.named_child(j))
1205 .find(|c| c.kind() == "user_type");
1206 let Some(user_type) = user_type else { continue };
1207 let type_id = (0..user_type.named_child_count())
1208 .filter_map(|j| user_type.named_child(j))
1209 .find(|c| c.kind() == "type_identifier");
1210 let Some(type_id) = type_id else { continue };
1211 let name = self.text(type_id).to_string();
1212 self.push_ref_at(class_row, &name, extends_kind, type_id);
1213 }
1214 }
1215
1216 /// extractTypeAnnotations — generic path: the 'parameter' field NEVER
1217 /// resolves (zero param refs), 'return_type' DOES; the direct

Callers 4

extract_classMethod · 0.45
extract_structMethod · 0.45
extract_enumMethod · 0.45
extract_interfaceMethod · 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