Skip to content

Commit 5875c37

Browse files
committed
[CSSyntacticElement] Replace global flag check with info from the solver
`transformedBody` is available only if the flag is set, so there is no reason to double-check it before application, the presence of the transformed body is evidence enough.
1 parent 4897461 commit 5875c37

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/Sema/CSSyntacticElement.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2116,11 +2116,9 @@ SolutionApplicationToFunctionResult ConstraintSystem::applySolution(
21162116
if (auto transform = solution.getAppliedBuilderTransform(fn)) {
21172117
NullablePtr<BraceStmt> newBody;
21182118

2119-
if (Context.LangOpts.hasFeature(Feature::ResultBuilderASTTransform)) {
2120-
BraceStmt *transformedBody =
2121-
const_cast<BraceStmt *>(transform->transformedBody.get());
2122-
2123-
fn.setParsedBody(transformedBody, /*singleExpression=*/false);
2119+
if (auto transformedBody = transform->transformedBody) {
2120+
fn.setParsedBody(const_cast<BraceStmt *>(transformedBody.get()),
2121+
/*singleExpression=*/false);
21242122

21252123
ResultBuilderRewriter rewriter(solution, fn, *transform, rewriteTarget);
21262124

0 commit comments

Comments
 (0)