Skip to content

Commit b6bffca

Browse files
committed
[silgen] prepareApplyExpr => CallEmission::forApplyExpr.
prepareApplyExpr is a static function that changes an expr into a CallEmission and has no other uses beyond that purpose. This is the definition of a static factory method. This PR performs that refactor. NFC.
1 parent 642cbba commit b6bffca

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/SILGen/SILGenApply.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3769,6 +3769,10 @@ namespace {
37693769
initialWritebackScope(std::move(writebackScope)),
37703770
expectedSiteCount(callee.getParameterListCount()) {}
37713771

3772+
/// A factory method for decomposing the apply expr \p e into a call
3773+
/// emission.
3774+
static CallEmission forApplyExpr(SILGenFunction &SGF, Expr *e);
3775+
37723776
/// Add a level of function application by passing in its possibly
37733777
/// unevaluated arguments and their formal type.
37743778
void addCallSite(CallSite &&site) {
@@ -4348,7 +4352,7 @@ RValue CallEmission::applyRemainingCallSites(RValue &&result,
43484352
return std::move(result);
43494353
}
43504354

4351-
static CallEmission prepareApplyExpr(SILGenFunction &SGF, Expr *e) {
4355+
CallEmission CallEmission::forApplyExpr(SILGenFunction &SGF, Expr *e) {
43524356
// Set up writebacks for the call(s).
43534357
FormalEvaluationScope writebacks(SGF);
43544358

@@ -4383,7 +4387,7 @@ static CallEmission prepareApplyExpr(SILGenFunction &SGF, Expr *e) {
43834387
}
43844388

43854389
RValue SILGenFunction::emitApplyExpr(Expr *e, SGFContext c) {
4386-
CallEmission emission = prepareApplyExpr(*this, e);
4390+
CallEmission emission = CallEmission::forApplyExpr(*this, e);
43874391
return emission.apply(c);
43884392
}
43894393

@@ -5271,7 +5275,7 @@ RValue SILGenFunction::emitApplyConversionFunction(SILLocation loc,
52715275
RValue &&operand) {
52725276
// Walk the function expression, which should produce a reference to the
52735277
// callee, leaving the final curry level unapplied.
5274-
CallEmission emission = prepareApplyExpr(*this, funcExpr);
5278+
CallEmission emission = CallEmission::forApplyExpr(*this, funcExpr);
52755279
// Rewrite the operand type to the expected argument type, to handle tuple
52765280
// conversions etc.
52775281
auto funcTy = cast<FunctionType>(funcExpr->getType()->getCanonicalType());

0 commit comments

Comments
 (0)