16
16
// ===----------------------------------------------------------------------===//
17
17
18
18
#include " ConstraintSystem.h"
19
+ #include " MiscDiagnostics.h"
19
20
#include " SolutionResult.h"
20
21
#include " TypeChecker.h"
21
22
#include " swift/AST/ASTVisitor.h"
@@ -645,7 +646,7 @@ class BuilderClosureRewriter
645
646
const Solution &solution;
646
647
DeclContext *dc;
647
648
AppliedBuilderTransform builderTransform;
648
- std::function<Expr *(Expr *)> rewriteExpr ;
649
+ std::function<Expr *(Expr *)> rewriteExprFn ;
649
650
std::function<Expr *(Expr *, Type, ConstraintLocator *)> coerceToType;
650
651
651
652
// / Retrieve the temporary variable that will be used to capture the
@@ -747,6 +748,13 @@ class BuilderClosureRewriter
747
748
elements.push_back (pbd);
748
749
}
749
750
751
+ Expr *rewriteExpr (Expr *expr) {
752
+ Expr *result = rewriteExprFn (expr);
753
+ if (result)
754
+ performSyntacticExprDiagnostics (expr, dc, /* isExprStmt=*/ false );
755
+ return result;
756
+ }
757
+
750
758
public:
751
759
BuilderClosureRewriter (
752
760
const Solution &solution,
@@ -756,7 +764,7 @@ class BuilderClosureRewriter
756
764
std::function<Expr *(Expr *, Type, ConstraintLocator *)> coerceToType
757
765
) : ctx(solution.getConstraintSystem().getASTContext()),
758
766
solution (solution), dc(dc), builderTransform(builderTransform),
759
- rewriteExpr (rewriteExpr),
767
+ rewriteExprFn (rewriteExpr),
760
768
coerceToType(coerceToType){ }
761
769
762
770
Stmt *visitBraceStmt (BraceStmt *braceStmt, FunctionBuilderTarget target,
0 commit comments