Skip to content

Commit 7b25bfc

Browse files
committed
ASTGen: Translate function generic parameter clauses
1 parent 6293332 commit 7b25bfc

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

include/swift/AST/CASTBridging.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ struct BridgedFuncDecl
325325
FuncDecl_create(BridgedASTContext cContext, BridgedDeclContext cDeclContext,
326326
BridgedSourceLoc cStaticLoc, BridgedSourceLoc cFuncKeywordLoc,
327327
BridgedIdentifier cName, BridgedSourceLoc cNameLoc,
328+
void *_Nullable opaqueGenericParamList,
328329
void *opaqueParameterList, BridgedSourceLoc cAsyncLoc,
329330
BridgedSourceLoc cThrowsLoc, void *_Nullable opaqueReturnType);
330331
void FuncDecl_setBody(void *fn, void *body);

lib/AST/CASTBridging.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ BridgedFuncDecl
446446
FuncDecl_create(BridgedASTContext cContext, BridgedDeclContext cDeclContext,
447447
BridgedSourceLoc cStaticLoc, BridgedSourceLoc cFuncKeywordLoc,
448448
BridgedIdentifier cName, BridgedSourceLoc cNameLoc,
449+
void *_Nullable opaqueGenericParamList,
449450
void *opaqueParameterList, BridgedSourceLoc cAsyncLoc,
450451
BridgedSourceLoc cThrowsLoc, void *_Nullable opaqueReturnType) {
451452
ASTContext &context = convertASTContext(cContext);
@@ -458,8 +459,9 @@ FuncDecl_create(BridgedASTContext cContext, BridgedDeclContext cDeclContext,
458459
auto *out = FuncDecl::create(
459460
context, convertSourceLoc(cStaticLoc), StaticSpellingKind::None,
460461
convertSourceLoc(cFuncKeywordLoc), declName, convertSourceLoc(cNameLoc),
461-
asyncLoc.isValid(), asyncLoc, throwsLoc.isValid(), throwsLoc, nullptr,
462-
paramList, static_cast<TypeRepr *>(opaqueReturnType),
462+
asyncLoc.isValid(), asyncLoc, throwsLoc.isValid(), throwsLoc,
463+
static_cast<GenericParamList *>(opaqueGenericParamList), paramList,
464+
static_cast<TypeRepr *>(opaqueReturnType),
463465
convertDeclContext(cDeclContext));
464466

465467
return {bridgeDeclContext(out), static_cast<FuncDecl *>(out),

lib/ASTGen/Sources/ASTGen/Decls.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ extension ASTGenVisitor {
9898
self.bridgedSourceLoc(for: node.funcKeyword),
9999
name,
100100
nameLoc,
101+
self.visit(node.genericParameterClause)?.rawValue,
101102
self.visit(node.signature.parameterClause).rawValue,
102103
self.bridgedSourceLoc(for: node.signature.effectSpecifiers?.asyncSpecifier),
103104
self.bridgedSourceLoc(for: node.signature.effectSpecifiers?.throwsSpecifier),

test/ASTGen/verify-parse.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ func test8(_ i: _const Int) {
7979

8080
func test9(_ value: Any) { }
8181

82+
func test10<T>(t: T) {}
83+
8284
typealias
8385
Alias<T>
8486
=

0 commit comments

Comments
 (0)