Skip to content

Commit 424112f

Browse files
committed
applyFunctionBuilderBodyTransform can be static
1 parent 4fa8fb6 commit 424112f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lib/Sema/BuilderTransform.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,8 @@ TypeChecker::applyFunctionBuilderBodyTransform(FuncDecl *FD,
484484
BraceStmt *body,
485485
Type builderType) {
486486
// Try to build a single result expression.
487-
BuilderClosureVisitor visitor(Context, nullptr,
487+
auto &ctx = FD->getASTContext();
488+
BuilderClosureVisitor visitor(ctx, nullptr,
488489
/*wantExpr=*/true, builderType);
489490
Expr *returnExpr = visitor.visit(body);
490491
if (!returnExpr)
@@ -496,9 +497,8 @@ TypeChecker::applyFunctionBuilderBodyTransform(FuncDecl *FD,
496497
return nullptr;
497498

498499
auto loc = returnExpr->getStartLoc();
499-
auto returnStmt =
500-
new (Context) ReturnStmt(loc, returnExpr, /*implicit*/ true);
501-
return BraceStmt::create(Context, body->getLBraceLoc(), { returnStmt },
500+
auto returnStmt = new (ctx) ReturnStmt(loc, returnExpr, /*implicit*/ true);
501+
return BraceStmt::create(ctx, body->getLBraceLoc(), { returnStmt },
502502
body->getRBraceLoc());
503503
}
504504

lib/Sema/TypeChecker.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -994,9 +994,9 @@ class TypeChecker final : public LazyResolver {
994994
SourceLoc EndTypeCheckLoc);
995995
bool typeCheckAbstractFunctionBody(AbstractFunctionDecl *AFD);
996996

997-
BraceStmt *applyFunctionBuilderBodyTransform(FuncDecl *FD,
998-
BraceStmt *body,
999-
Type builderType);
997+
static BraceStmt *applyFunctionBuilderBodyTransform(FuncDecl *FD,
998+
BraceStmt *body,
999+
Type builderType);
10001000
bool typeCheckClosureBody(ClosureExpr *closure);
10011001

10021002
bool typeCheckTapBody(TapExpr *expr, DeclContext *DC);

0 commit comments

Comments
 (0)