@@ -2289,6 +2289,20 @@ synthesizeModifyCoroutineBody(AccessorDecl *modify, ASTContext &ctx) {
2289
2289
return synthesizeCoroutineAccessorBody (modify, ctx);
2290
2290
}
2291
2291
2292
+ // / Synthesize the body of a modify coroutine.
2293
+ static std::pair<BraceStmt *, bool >
2294
+ synthesizeModify2CoroutineBody (AccessorDecl *modify, ASTContext &ctx) {
2295
+ #ifndef NDEBUG
2296
+ auto storage = modify->getStorage ();
2297
+ auto impl = storage->getReadWriteImpl ();
2298
+ auto hasWrapper = isa<VarDecl>(storage) &&
2299
+ cast<VarDecl>(storage)->hasAttachedPropertyWrapper ();
2300
+ assert ((hasWrapper || impl != ReadWriteImplKind::Modify2) &&
2301
+ impl != ReadWriteImplKind::Immutable);
2302
+ #endif
2303
+ return synthesizeCoroutineAccessorBody (modify, ctx);
2304
+ }
2305
+
2292
2306
static std::pair<BraceStmt *, bool >
2293
2307
synthesizeAccessorBody (AbstractFunctionDecl *fn, void *) {
2294
2308
auto *accessor = cast<AccessorDecl>(fn);
@@ -2312,9 +2326,11 @@ synthesizeAccessorBody(AbstractFunctionDecl *fn, void *) {
2312
2326
return synthesizeRead2CoroutineBody (accessor, ctx);
2313
2327
2314
2328
case AccessorKind::Modify:
2315
- case AccessorKind::Modify2:
2316
2329
return synthesizeModifyCoroutineBody (accessor, ctx);
2317
2330
2331
+ case AccessorKind::Modify2:
2332
+ return synthesizeModify2CoroutineBody (accessor, ctx);
2333
+
2318
2334
case AccessorKind::WillSet:
2319
2335
case AccessorKind::DidSet:
2320
2336
case AccessorKind::Address:
0 commit comments