Skip to content

Commit a49bf19

Browse files
committed
ASTGen: Translate class generic parameter clauses
1 parent 7b25bfc commit a49bf19

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

include/swift/AST/CASTBridging.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,9 @@ StructDecl_create(BridgedASTContext cContext, BridgedDeclContext cDeclContext,
359359
BridgedDeclContextAndDecl
360360
ClassDecl_create(BridgedASTContext cContext, BridgedDeclContext cDeclContext,
361361
BridgedSourceLoc cClassKeywordLoc, BridgedIdentifier cName,
362-
BridgedSourceLoc cNameLoc, BridgedSourceRange cBraceRange);
362+
BridgedSourceLoc cNameLoc,
363+
void *_Nullable opaqueGenericParamList,
364+
BridgedSourceRange cBraceRange);
363365

364366
void *GenericParamList_create(BridgedASTContext cContext,
365367
BridgedSourceLoc cLAngleLoc,

lib/AST/CASTBridging.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,12 +576,15 @@ StructDecl_create(BridgedASTContext cContext, BridgedDeclContext cDeclContext,
576576
BridgedDeclContextAndDecl
577577
ClassDecl_create(BridgedASTContext cContext, BridgedDeclContext cDeclContext,
578578
BridgedSourceLoc cClassKeywordLoc, BridgedIdentifier cName,
579-
BridgedSourceLoc cNameLoc, BridgedSourceRange cBraceRange) {
579+
BridgedSourceLoc cNameLoc,
580+
void *_Nullable opaqueGenericParamList,
581+
BridgedSourceRange cBraceRange) {
580582
ASTContext &context = convertASTContext(cContext);
581583

582584
auto *decl = new (context)
583585
ClassDecl(convertSourceLoc(cClassKeywordLoc), convertIdentifier(cName),
584-
convertSourceLoc(cNameLoc), {}, nullptr,
586+
convertSourceLoc(cNameLoc), {},
587+
static_cast<GenericParamList *>(opaqueGenericParamList),
585588
convertDeclContext(cDeclContext), false);
586589
decl->setBraces(convertSourceRange(cBraceRange));
587590

lib/ASTGen/Sources/ASTGen/Decls.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ extension ASTGenVisitor {
5353
self.bridgedSourceLoc(for: node.classKeyword),
5454
name,
5555
nameLoc,
56+
self.visit(node.genericParameterClause)?.rawValue,
5657
BridgedSourceRange(startToken: node.memberBlock.leftBrace, endToken: node.memberBlock.rightBrace, in: self)
5758
)
5859

test/ASTGen/verify-parse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,6 @@ Struct
9797
}
9898

9999
class
100-
Class {
100+
Class<T> {
101101
func method(_ b: Bool) {}
102102
}

0 commit comments

Comments
 (0)