File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed
branches/swift-5.1-branch/lib/Parse Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -1242,7 +1242,7 @@ refs/heads/marcrasi-astverifier-disable: 3fac766a23a77ebd0640296bfd7fc116ea60a4e
1242
1242
refs/heads/revert-22227-a-tall-white-fountain-played: adfce60b2eaa54903ea189bed8a783bca609fa53
1243
1243
refs/heads/revert-22300-revert-22227-a-tall-white-fountain-played: 5f92040224df7dd4e618fdfb367349df64d8acad
1244
1244
refs/heads/swift-5.1-old-llvm-branch: 9cef8175146f25b72806154b8a0f4a3f52e3e400
1245
- refs/heads/swift-5.1-branch: 6df93383ae7301008c957a96bd41766ee131dce0
1245
+ refs/heads/swift-5.1-branch: 547e0b4e625bd90d9dc3f34f02744ba9d54e2a56
1246
1246
refs/tags/swift-4.2.2-RELEASE: e429d1f1aaf59e69d38207a96e56265c7f6fccec
1247
1247
refs/tags/swift-5.0-DEVELOPMENT-SNAPSHOT-2019-02-02-a: 3e5a03d32ff3b1e9af90d6c1198c14f938379a6e
1248
1248
refs/tags/swift-5.0-DEVELOPMENT-SNAPSHOT-2019-02-03-a: 4591c933063ddcb0d6cd6d0cdd01086b2f9b244d
Original file line number Diff line number Diff line change @@ -5649,15 +5649,19 @@ void Parser::parseAbstractFunctionBody(AbstractFunctionDecl *AFD) {
5649
5649
if (!Body.hasCodeCompletion () && BS->getNumElements () == 1 ) {
5650
5650
auto Element = BS->getElement (0 );
5651
5651
if (auto *stmt = Element.dyn_cast <Stmt *>()) {
5652
- if (auto *returnStmt = dyn_cast<ReturnStmt>(stmt)) {
5653
- if (!returnStmt->hasResult ()) {
5654
- auto returnExpr = TupleExpr::createEmpty (Context,
5655
- SourceLoc (),
5656
- SourceLoc (),
5657
- /* implicit*/ true );
5658
- returnStmt->setResult (returnExpr);
5659
- AFD->setHasSingleExpressionBody ();
5660
- AFD->setSingleExpressionBody (returnExpr);
5652
+ auto kind = AFD->getKind ();
5653
+ if (kind == DeclKind::Var || kind == DeclKind::Subscript ||
5654
+ kind == DeclKind::Func ) {
5655
+ if (auto *returnStmt = dyn_cast<ReturnStmt>(stmt)) {
5656
+ if (!returnStmt->hasResult ()) {
5657
+ auto returnExpr = TupleExpr::createEmpty (Context,
5658
+ SourceLoc (),
5659
+ SourceLoc (),
5660
+ /* implicit*/ true );
5661
+ returnStmt->setResult (returnExpr);
5662
+ AFD->setHasSingleExpressionBody ();
5663
+ AFD->setSingleExpressionBody (returnExpr);
5664
+ }
5661
5665
}
5662
5666
}
5663
5667
} else if (auto *E = Element.dyn_cast <Expr *>()) {
You can’t perform that action at this time.
0 commit comments