Skip to content

Commit a7b4d36

Browse files
committed
Add pre-expr visit
Adding an expression pre-visit to the EffectHandling walker, allowing sub-classes visit all expressions.
1 parent 3116eed commit a7b4d36

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/Sema/TypeCheckEffects.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ class EffectsHandlingWalker : public ASTWalker {
427427
}
428428

429429
std::pair<bool, Expr*> walkToExprPre(Expr *E) override {
430+
visitExprPre(E);
430431
ShouldRecurse_t recurse = ShouldRecurse;
431432
if (isa<ErrorExpr>(E)) {
432433
asImpl().flagInvalidCode();
@@ -486,6 +487,8 @@ class EffectsHandlingWalker : public ASTWalker {
486487
ShouldRecurse_t checkForEach(ForEachStmt *S) {
487488
return ShouldRecurse;
488489
}
490+
491+
void visitExprPre(Expr *expr) { asImpl().visitExprPre(expr); }
489492
};
490493

491494
/// A potential reason why something might have an effect.
@@ -1098,6 +1101,8 @@ class ApplyClassifier {
10981101
// guaranteed to give back None, which leaves our ThrowKind unchanged.
10991102
}
11001103
}
1104+
1105+
void visitExprPre(Expr *expr) { return; }
11011106
};
11021107

11031108
class FunctionAsyncClassifier
@@ -1182,6 +1187,8 @@ class ApplyClassifier {
11821187

11831188
return ShouldRecurse;
11841189
}
1190+
1191+
void visitExprPre(Expr *expr) { return; }
11851192
};
11861193

11871194
Optional<ConditionalEffectKind>
@@ -2290,6 +2297,8 @@ class CheckEffectsCoverage : public EffectsHandlingWalker<CheckEffectsCoverage>
22902297
}
22912298

22922299
private:
2300+
void visitExprPre(Expr *expr) { return; }
2301+
22932302
ShouldRecurse_t checkClosure(ClosureExpr *E) {
22942303
ContextScope scope(*this, Context::forClosure(E));
22952304
scope.enterSubFunction();

0 commit comments

Comments
 (0)