File tree Expand file tree Collapse file tree 1 file changed +8
-28
lines changed Expand file tree Collapse file tree 1 file changed +8
-28
lines changed Original file line number Diff line number Diff line change @@ -2427,37 +2427,17 @@ Expr *PreCheckExpression::simplifyTypeConstructionWithLiteralArg(Expr *E) {
2427
2427
2428
2428
bool ConstraintSystem::preCheckTarget (SyntacticElementTarget &target) {
2429
2429
auto *DC = target.getDeclContext ();
2430
+ auto &ctx = DC->getASTContext ();
2430
2431
2431
- bool hadErrors = false ;
2432
-
2433
- if (auto *expr = target.getAsExpr ()) {
2434
- hadErrors |= preCheckExpression (expr, DC);
2435
- // Even if the pre-check fails, expression still has to be re-set.
2436
- target.setExpr (expr);
2437
- }
2438
-
2439
- if (target.isForEachPreamble ()) {
2440
- auto *stmt = target.getAsForEachStmt ();
2441
-
2442
- auto *sequenceExpr = stmt->getParsedSequence ();
2443
- auto *whereExpr = stmt->getWhere ();
2444
-
2445
- hadErrors |= preCheckExpression (sequenceExpr, DC);
2446
-
2447
- if (whereExpr) {
2448
- hadErrors |= preCheckExpression (whereExpr, DC);
2449
- }
2450
-
2451
- // Update sequence and where expressions to pre-checked versions.
2452
- if (!hadErrors) {
2453
- stmt->setParsedSequence (sequenceExpr);
2432
+ FrontendStatsTracer StatsTracer (ctx.Stats , " precheck-target" );
2433
+ PreCheckExpression preCheck (DC);
2454
2434
2455
- if (whereExpr)
2456
- stmt->setWhere (whereExpr);
2457
- }
2458
- }
2435
+ auto newTarget = target.walk (preCheck);
2436
+ if (!newTarget)
2437
+ return true ;
2459
2438
2460
- return hadErrors;
2439
+ target = *newTarget;
2440
+ return false ;
2461
2441
}
2462
2442
2463
2443
// / Pre-check the expression, validating any types that occur in the
You can’t perform that action at this time.
0 commit comments