@@ -1834,7 +1834,7 @@ bool RefactoringActionCollapseNestedIfStmt::performChange() {
1834
1834
EditConsumer, SM,
1835
1835
Lexer::getCharSourceRangeFromSourceRange (SM, OuterIf->getSourceRange ()));
1836
1836
1837
- OS << tok::kw_if << " " ;
1837
+ OS << tok::kw_if << " " ;
1838
1838
1839
1839
// Emit conditions.
1840
1840
bool first = true ;
@@ -6422,21 +6422,7 @@ class AsyncConverter : private SourceEntityWalker {
6422
6422
// Print the function result type, making sure to omit a '-> Void' return.
6423
6423
if (!TopHandler.willAsyncReturnVoid ()) {
6424
6424
OS << " -> " ;
6425
- if (ReturnTypes.size () > 1 )
6426
- OS << " (" ;
6427
-
6428
- llvm::interleave (
6429
- ReturnTypes,
6430
- [&](LabeledReturnType TypeAndLabel) {
6431
- if (!TypeAndLabel.Label .empty ()) {
6432
- OS << TypeAndLabel.Label << tok::colon << " " ;
6433
- }
6434
- TypeAndLabel.Ty ->print (OS);
6435
- },
6436
- [&]() { OS << " , " ; });
6437
-
6438
- if (ReturnTypes.size () > 1 )
6439
- OS << " )" ;
6425
+ addAsyncFuncReturnType (TopHandler);
6440
6426
}
6441
6427
6442
6428
if (FD->hasBody ())
@@ -6477,10 +6463,13 @@ class AsyncConverter : private SourceEntityWalker {
6477
6463
// for the completion handler call, e.g 'return completion(args...)'. In
6478
6464
// that case, be sure not to add another return.
6479
6465
auto *parent = getWalker ().Parent .getAsStmt ();
6480
- AddedReturnOrThrow = !(parent && isa<ReturnStmt>(parent) &&
6481
- !cast<ReturnStmt>(parent)->isImplicit ());
6482
- if (AddedReturnOrThrow)
6466
+ if (parent && isa<ReturnStmt>(parent) &&
6467
+ !cast<ReturnStmt>(parent)->isImplicit ()) {
6468
+ // The statement already has a return keyword. Don't add another one.
6469
+ AddedReturnOrThrow = false ;
6470
+ } else {
6483
6471
OS << tok::kw_return;
6472
+ }
6484
6473
} else {
6485
6474
OS << tok::kw_throw;
6486
6475
}
0 commit comments