@@ -2289,6 +2289,20 @@ synthesizeModifyCoroutineBody(AccessorDecl *modify, ASTContext &ctx) {
22892289 return synthesizeCoroutineAccessorBody (modify, ctx);
22902290}
22912291
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+
22922306static std::pair<BraceStmt *, bool >
22932307synthesizeAccessorBody (AbstractFunctionDecl *fn, void *) {
22942308 auto *accessor = cast<AccessorDecl>(fn);
@@ -2312,9 +2326,11 @@ synthesizeAccessorBody(AbstractFunctionDecl *fn, void *) {
23122326 return synthesizeRead2CoroutineBody (accessor, ctx);
23132327
23142328 case AccessorKind::Modify:
2315- case AccessorKind::Modify2:
23162329 return synthesizeModifyCoroutineBody (accessor, ctx);
23172330
2331+ case AccessorKind::Modify2:
2332+ return synthesizeModify2CoroutineBody (accessor, ctx);
2333+
23182334 case AccessorKind::WillSet:
23192335 case AccessorKind::DidSet:
23202336 case AccessorKind::Address:
0 commit comments