|
@@ -583,6 +583,9 @@ export class TreeSitterExtractor {
|
|
|
});
|
|
});
|
|
|
if (!structNode) return;
|
|
if (!structNode) return;
|
|
|
|
|
|
|
|
|
|
+ // Extract inheritance (e.g. Swift: struct HTTPMethod: RawRepresentable)
|
|
|
|
|
+ this.extractInheritance(node, structNode.id);
|
|
|
|
|
+
|
|
|
// Push to stack for field extraction
|
|
// Push to stack for field extraction
|
|
|
this.nodeStack.push(structNode.id);
|
|
this.nodeStack.push(structNode.id);
|
|
|
const body = getChildByField(node, this.extractor.bodyField) || node;
|
|
const body = getChildByField(node, this.extractor.bodyField) || node;
|
|
@@ -1309,6 +1312,23 @@ export class TreeSitterExtractor {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Swift: inheritance_specifier > user_type > type_identifier
|
|
|
|
|
+ // Used for class inheritance, protocol conformance, and protocol inheritance
|
|
|
|
|
+ if (child.type === 'inheritance_specifier') {
|
|
|
|
|
+ const userType = child.namedChildren.find((c: SyntaxNode) => c.type === 'user_type');
|
|
|
|
|
+ const typeId = userType?.namedChildren.find((c: SyntaxNode) => c.type === 'type_identifier');
|
|
|
|
|
+ if (typeId) {
|
|
|
|
|
+ const name = getNodeText(typeId, this.source);
|
|
|
|
|
+ this.unresolvedReferences.push({
|
|
|
|
|
+ fromNodeId: classId,
|
|
|
|
|
+ referenceName: name,
|
|
|
|
|
+ referenceKind: 'extends',
|
|
|
|
|
+ line: typeId.startPosition.row + 1,
|
|
|
|
|
+ column: typeId.startPosition.column,
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// Recurse into container nodes (e.g. field_declaration_list in Go structs)
|
|
// Recurse into container nodes (e.g. field_declaration_list in Go structs)
|
|
|
if (child.type === 'field_declaration_list') {
|
|
if (child.type === 'field_declaration_list') {
|
|
|
this.extractInheritance(child, classId);
|
|
this.extractInheritance(child, classId);
|