@@ -150,6 +150,23 @@ class AnyFunctionRef {
150
150
return cast<AutoClosureExpr>(ACE)->getBody ();
151
151
}
152
152
153
+ void setParsedBody (BraceStmt *stmt, bool isSingleExpression) {
154
+ if (auto *AFD = TheFunction.dyn_cast <AbstractFunctionDecl *>()) {
155
+ AFD->setBody (stmt, AbstractFunctionDecl::BodyKind::Parsed);
156
+ AFD->setHasSingleExpressionBody (isSingleExpression);
157
+ return ;
158
+ }
159
+
160
+ auto *ACE = TheFunction.get <AbstractClosureExpr *>();
161
+ if (auto *CE = dyn_cast<ClosureExpr>(ACE)) {
162
+ CE->setBody (stmt, isSingleExpression);
163
+ CE->setBodyState (ClosureExpr::BodyState::ReadyForTypeChecking);
164
+ return ;
165
+ }
166
+
167
+ llvm_unreachable (" autoclosures don't have statement bodies" );
168
+ }
169
+
153
170
void setTypecheckedBody (BraceStmt *stmt, bool isSingleExpression) {
154
171
if (auto *AFD = TheFunction.dyn_cast <AbstractFunctionDecl *>()) {
155
172
AFD->setBody (stmt, AbstractFunctionDecl::BodyKind::TypeChecked);
@@ -159,7 +176,9 @@ class AnyFunctionRef {
159
176
160
177
auto *ACE = TheFunction.get <AbstractClosureExpr *>();
161
178
if (auto *CE = dyn_cast<ClosureExpr>(ACE)) {
162
- return CE->setBody (stmt, isSingleExpression);
179
+ CE->setBody (stmt, isSingleExpression);
180
+ CE->setBodyState (ClosureExpr::BodyState::TypeCheckedWithSignature);
181
+ return ;
163
182
}
164
183
165
184
llvm_unreachable (" autoclosures don't have statement bodies" );
0 commit comments