Skip to content

Commit

Permalink
[Property Wrappers] Generalize a few property wrapper decl context
Browse files Browse the repository at this point in the history
checks to check for type context instead of local context.

This generalization will help us implement property wrappers on
global variables, which should use the same approach of not adding
synthesized accessors to the AST and instead lazily visit them in
SILGen.
  • Loading branch information
hborla committed Sep 29, 2020
1 parent 21cbdfa commit 2a67c65
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5957,7 +5957,7 @@ VarDecl *VarDecl::getPropertyWrapperProjectionVar() const {
}

void VarDecl::visitAuxiliaryDecls(llvm::function_ref<void(VarDecl *)> visit) const {
if (!getDeclContext()->isLocalContext())
if (getDeclContext()->isTypeContext())
return;

if (auto *backingVar = getPropertyWrapperBackingProperty())
Expand Down
2 changes: 1 addition & 1 deletion lib/SIL/IR/SILDeclRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ IsSerialized_t SILDeclRef::isSerialized() const {
// Stored property initializers are inlinable if the type is explicitly
// marked as @frozen.
if (isStoredPropertyInitializer() || (isPropertyWrapperBackingInitializer() &&
!d->getDeclContext()->isLocalContext())) {
d->getDeclContext()->isTypeContext())) {
auto *nominal = cast<NominalTypeDecl>(d->getDeclContext());
auto scope =
nominal->getFormalAccessScope(/*useDC=*/nullptr,
Expand Down

0 comments on commit 2a67c65

Please sign in to comment.