Skip to content

Commit 2a67c65

Browse files
committed
[Property Wrappers] Generalize a few property wrapper decl context
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.
1 parent 21cbdfa commit 2a67c65

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/AST/Decl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5957,7 +5957,7 @@ VarDecl *VarDecl::getPropertyWrapperProjectionVar() const {
59575957
}
59585958

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

59635963
if (auto *backingVar = getPropertyWrapperBackingProperty())

lib/SIL/IR/SILDeclRef.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ IsSerialized_t SILDeclRef::isSerialized() const {
488488
// Stored property initializers are inlinable if the type is explicitly
489489
// marked as @frozen.
490490
if (isStoredPropertyInitializer() || (isPropertyWrapperBackingInitializer() &&
491-
!d->getDeclContext()->isLocalContext())) {
491+
d->getDeclContext()->isTypeContext())) {
492492
auto *nominal = cast<NominalTypeDecl>(d->getDeclContext());
493493
auto scope =
494494
nominal->getFormalAccessScope(/*useDC=*/nullptr,

0 commit comments

Comments
 (0)