@@ -607,6 +607,16 @@ getPropertyWrapperLValueness(VarDecl *var) {
607
607
// / Build a reference to the storage of a declaration. Returns nullptr if there
608
608
// / was an error. This should only occur if an invalid declaration was type
609
609
// / checked; another diagnostic should have been emitted already.
610
+ // /
611
+ // / The resulting reference is used in synthesized property accessors and is of
612
+ // / one of the following forms:
613
+ // / 1. Without property wrappers:
614
+ // / - Stored: \c self.member
615
+ // / 2. With property wrappers:
616
+ // / - Wrapped: \c self._member.wrappedValue
617
+ // / - Composition: \c self._member.wrappedValue.wrappedValue….wrappedValue
618
+ // / - Projected: \c self._member.projectedValue
619
+ // / - Enclosed instance: \c Wrapper[_enclosedInstance: self, …]
610
620
static Expr *buildStorageReference (AccessorDecl *accessor,
611
621
AbstractStorageDecl *storage,
612
622
TargetImpl target,
@@ -618,6 +628,8 @@ static Expr *buildStorageReference(AccessorDecl *accessor,
618
628
// Local function to "finish" the expression, creating a member reference
619
629
// to the given sequence of underlying variables.
620
630
Optional<EnclosingSelfPropertyWrapperAccess> enclosingSelfAccess;
631
+ // Contains the underlying wrappedValue declaration in a property wrapper
632
+ // along with whether or not the reference to this field needs to be an lvalue
621
633
llvm::SmallVector<std::pair<VarDecl *, bool >, 1 > underlyingVars;
622
634
auto finish = [&](Expr *result) -> Expr * {
623
635
for (auto underlyingVarPair : underlyingVars) {
@@ -1755,9 +1767,9 @@ synthesizeCoroutineAccessorBody(AccessorDecl *accessor, ASTContext &ctx) {
1755
1767
1756
1768
// Build a reference to the storage.
1757
1769
Expr *ref = buildStorageReference (accessor, storage, target,
1758
- /* isUsedForGetAccess=*/ true ,
1759
- /* isUsedForSetAccess=*/ isModify,
1760
- ctx);
1770
+ /* isUsedForGetAccess=*/ true ,
1771
+ /* isUsedForSetAccess=*/ isModify,
1772
+ ctx);
1761
1773
if (ref != nullptr ) {
1762
1774
// Wrap it with an `&` marker if this is a modify.
1763
1775
ref = maybeWrapInOutExpr (ref, ctx);
0 commit comments