mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[AST] Remove the "single expression body" bit
Remove this bit from function decls and closures. Instead, for closures, infer it from the presence of a single return or single expression AST node in the body, which ought to be equivalent, and automatically takes result builders into consideration. We can also completely drop this query from AbstractFunctionDecl, replacing it instead with a bit on ReturnStmt.
This commit is contained in:
@@ -279,7 +279,7 @@ private:
|
||||
ASTNode ClosureElements[] = {OriginalExpr, CheckExpectExpr};
|
||||
auto *ClosureBody = BraceStmt::create(Ctx, SourceLoc(), ClosureElements,
|
||||
SourceLoc(), /*Implicit=*/true);
|
||||
Closure->setBody(ClosureBody, /*isSingleExpression=*/false);
|
||||
Closure->setBody(ClosureBody);
|
||||
|
||||
// Call the closure.
|
||||
auto *ClosureCall = CallExpr::createImplicitEmpty(Ctx, Closure);
|
||||
|
||||
Reference in New Issue
Block a user