Skip to content

Commit 4774277

Browse files
committed
[Typechecker] Simplify StorageImplInfo code in finishPropertyWrapperImplInfo and check for AccessorKind in synthesizeCoroutineAccessorBody
1 parent 4b6350e commit 4774277

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lib/Sema/TypeCheckStorage.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,7 @@ synthesizeCoroutineAccessorBody(AccessorDecl *accessor, ASTContext &ctx) {
15851585

15861586
// If this is a variable with an attached property wrapper, then
15871587
// the accessors need to yield the wrappedValue or projectedValue.
1588-
if (storage->getReadImpl() == ReadImplKind::Read ||
1588+
if (accessor->getAccessorKind() == AccessorKind::Read ||
15891589
storageReadWriteImpl == ReadWriteImplKind::Modify) {
15901590
if (auto var = dyn_cast<VarDecl>(storage)) {
15911591
if (var->hasAttachedPropertyWrapper()) {
@@ -2582,15 +2582,16 @@ static void finishPropertyWrapperImplInfo(VarDecl *var,
25822582
}
25832583
}
25842584

2585-
if (wrapperSetterIsUsable) {
2586-
if (var->hasObservers()) {
2587-
info = StorageImplInfo::getMutableComputed();
2588-
return;
2589-
}
2585+
if (!wrapperSetterIsUsable) {
2586+
info = StorageImplInfo::getImmutableComputed();
2587+
return;
2588+
}
2589+
2590+
if (var->hasObservers()) {
2591+
info = StorageImplInfo::getMutableComputed();
2592+
} else {
25902593
info = StorageImplInfo(ReadImplKind::Get, WriteImplKind::Set,
25912594
ReadWriteImplKind::Modify);
2592-
} else {
2593-
info = StorageImplInfo::getImmutableComputed();
25942595
}
25952596
}
25962597

0 commit comments

Comments
 (0)