Skip to content

Commit 37c89f1

Browse files
committed
[Function builders] allowOneWay->oneWay and clean up some logic
1 parent 63ef99e commit 37c89f1

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lib/Sema/BuilderTransform.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class BuilderClosureVisitor
5353
Expr *buildCallIfWanted(SourceLoc loc,
5454
Identifier fnName, ArrayRef<Expr *> args,
5555
ArrayRef<Identifier> argLabels,
56-
bool allowOneWay) {
56+
bool oneWay) {
5757
if (!wantExpr)
5858
return nullptr;
5959

@@ -87,7 +87,7 @@ class BuilderClosureVisitor
8787
/*trailing closure*/ nullptr,
8888
/*implicit*/true);
8989

90-
if (allowOneWay) {
90+
if (oneWay) {
9191
// Form a one-way constraint to prevent backward propagation.
9292
result = new (ctx) OneWayExpr(result);
9393
}
@@ -173,10 +173,10 @@ class BuilderClosureVisitor
173173
if (builderSupports(ctx.Id_buildExpression)) {
174174
expr = buildCallIfWanted(expr->getLoc(), ctx.Id_buildExpression,
175175
{ expr }, { Identifier() },
176-
/*allowOneWay=*/true);
177-
} else {
178-
expr = new (ctx) OneWayExpr(expr);
176+
/*oneWay=*/false);
179177
}
178+
179+
expr = new (ctx) OneWayExpr(expr);
180180
}
181181

182182
expressions.push_back(expr);
@@ -186,7 +186,7 @@ class BuilderClosureVisitor
186186
return buildCallIfWanted(braceStmt->getStartLoc(),
187187
ctx.Id_buildBlock, expressions,
188188
/*argLabels=*/{ },
189-
/*allowOneWay=*/true);
189+
/*oneWay=*/true);
190190
}
191191

192192
Expr *visitReturnStmt(ReturnStmt *stmt) {
@@ -212,7 +212,7 @@ class BuilderClosureVisitor
212212
return nullptr;
213213

214214
return buildCallIfWanted(doStmt->getStartLoc(), ctx.Id_buildDo, arg,
215-
/*argLabels=*/{ }, /*allowOneWay=*/true);
215+
/*argLabels=*/{ }, /*oneWay=*/true);
216216
}
217217

218218
CONTROL_FLOW_STMT(Yield)
@@ -299,7 +299,7 @@ class BuilderClosureVisitor
299299
chainExpr = buildCallIfWanted(ifStmt->getStartLoc(),
300300
ctx.Id_buildIf, chainExpr,
301301
/*argLabels=*/{ },
302-
/*allowOneWay=*/true);
302+
/*oneWay=*/true);
303303
} else {
304304
// Form a one-way constraint to prevent backward propagation.
305305
chainExpr = new (ctx) OneWayExpr(chainExpr);
@@ -423,7 +423,7 @@ class BuilderClosureVisitor
423423
operand = buildCallIfWanted(operand->getStartLoc(),
424424
ctx.Id_buildEither, operand,
425425
{isSecond ? ctx.Id_second : ctx.Id_first},
426-
/*allowOneWay=*/false);
426+
/*oneWay=*/false);
427427
}
428428

429429
// Inject into Optional if required. We'll be adding the call to

0 commit comments

Comments
 (0)