@@ -104,12 +104,7 @@ namespace {
104
104
105
105
if (auto CE = dyn_cast<ClosureExpr>(E)) {
106
106
CE->setParent (ParentDC);
107
-
108
- // If the closure was type checked within its enclosing context,
109
- // we need to walk into it. Otherwise, it'll have been separately
110
- // type-checked.
111
- if (!CE->isSeparatelyTypeChecked ())
112
- CE->getBody ()->walk (ContextualizeClosuresAndMacros (CE));
107
+ CE->getBody ()->walk (ContextualizeClosuresAndMacros (CE));
113
108
114
109
TypeChecker::computeCaptures (CE);
115
110
return Action::SkipNode (E);
@@ -283,18 +278,14 @@ namespace {
283
278
if (CE->getRawDiscriminator () == ClosureExpr::InvalidDiscriminator)
284
279
CE->setDiscriminator (NextClosureDiscriminator++);
285
280
286
- // If the closure was type checked within its enclosing context,
287
- // we need to walk into it with a new sequence.
288
- // Otherwise, it'll have been separately type-checked.
289
- if (!CE->isSeparatelyTypeChecked ()) {
290
- SetLocalDiscriminators innerVisitor;
291
- if (auto params = CE->getParameters ()) {
292
- for (auto *param : *params) {
293
- innerVisitor.setLocalDiscriminator (param);
294
- }
281
+ // We need to walk into closure bodies with a new sequence.
282
+ SetLocalDiscriminators innerVisitor;
283
+ if (auto params = CE->getParameters ()) {
284
+ for (auto *param : *params) {
285
+ innerVisitor.setLocalDiscriminator (param);
295
286
}
296
- CE->getBody ()->walk (innerVisitor);
297
287
}
288
+ CE->getBody ()->walk (innerVisitor);
298
289
299
290
return Action::SkipNode (E);
300
291
}
@@ -2978,25 +2969,6 @@ TypeCheckFunctionBodyRequest::evaluate(Evaluator &eval,
2978
2969
return hadError ? errorBody () : body;
2979
2970
}
2980
2971
2981
- bool TypeChecker::typeCheckClosureBody (ClosureExpr *closure) {
2982
- TypeChecker::checkClosureAttributes (closure);
2983
- TypeChecker::checkParameterList (closure->getParameters (), closure);
2984
-
2985
- BraceStmt *body = closure->getBody ();
2986
-
2987
- std::optional<FunctionBodyTimer> timer;
2988
- const auto &tyOpts = closure->getASTContext ().TypeCheckerOpts ;
2989
- if (tyOpts.DebugTimeFunctionBodies || tyOpts.WarnLongFunctionBodies )
2990
- timer.emplace (closure);
2991
-
2992
- bool HadError = StmtChecker (closure).typeCheckBody (body);
2993
- if (body) {
2994
- closure->setBody (body);
2995
- }
2996
- closure->setBodyState (ClosureExpr::BodyState::SeparatelyTypeChecked);
2997
- return HadError;
2998
- }
2999
-
3000
2972
bool TypeChecker::typeCheckTapBody (TapExpr *expr, DeclContext *DC) {
3001
2973
// We intentionally use typeCheckStmt instead of typeCheckBody here
3002
2974
// because we want to contextualize TapExprs with the body they're in.
0 commit comments