Skip to content

Commit cdbba60

Browse files
committed
AST: ASTPrinter support for 'reasync'
Part of <rdar://problem/71098795>.
1 parent 6c69d17 commit cdbba60

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3152,7 +3152,10 @@ void PrintAST::printFunctionParameters(AbstractFunctionDecl *AFD) {
31523152

31533153
if (AFD->hasAsync()) {
31543154
Printer << " ";
3155-
Printer.printKeyword("async", Options);
3155+
if (AFD->getAttrs().hasAttribute<ReasyncAttr>())
3156+
Printer.printKeyword("reasync", Options);
3157+
else
3158+
Printer.printKeyword("async", Options);
31563159
}
31573160

31583161
if (AFD->hasThrows()) {

lib/AST/Attr.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,7 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
724724
case DAK_ObjCBridged:
725725
case DAK_SynthesizedProtocol:
726726
case DAK_Rethrows:
727+
case DAK_Reasync:
727728
case DAK_Infix:
728729
return false;
729730
case DAK_Override: {

test/ModuleInterface/concurrency.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ public func fn() async {
88
fatalError()
99
}
1010

11+
public func reasyncFn(_: () async -> ()) reasync {
12+
fatalError()
13+
}
14+
1115
// RUN: %target-typecheck-verify-swift -enable-experimental-concurrency -I %t
1216

1317
#else
@@ -21,3 +25,4 @@ func callFn() async {
2125
// RUN: %FileCheck %s <%t/Library.swiftinterface
2226
// CHECK: // swift-module-flags:{{.*}} -enable-experimental-concurrency
2327
// CHECK: public func fn() async
28+
// CHECK: public func reasyncFn(_: () async -> ()) reasync

0 commit comments

Comments
 (0)