Skip to content

Commit 1769ae9

Browse files
committed
Only create ErrorExpr when the CallerSideDefaultArgExprRequest is cyclic
Right now, we're creating a bunch of throwaway ErrorExpr nodes in the AST.
1 parent aa4c548 commit 1769ae9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/AST/Expr.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,9 +1633,12 @@ Expr *DefaultArgumentExpr::getCallerSideDefaultExpr() const {
16331633
assert(isCallerSide());
16341634
auto &ctx = DefaultArgsOwner.getDecl()->getASTContext();
16351635
auto *mutableThis = const_cast<DefaultArgumentExpr *>(this);
1636-
return evaluateOrDefault(ctx.evaluator,
1636+
if (auto result = evaluateOrDefault(ctx.evaluator,
16371637
CallerSideDefaultArgExprRequest{mutableThis},
1638-
new (ctx) ErrorExpr(getSourceRange(), getType()));
1638+
nullptr))
1639+
return result;
1640+
1641+
return new (ctx) ErrorExpr(getSourceRange(), getType());
16391642
}
16401643

16411644
ActorIsolation

0 commit comments

Comments
 (0)