mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
AST: Clean up the terminology around @usableFromInline in a couple of places
This commit is contained in:
@@ -1519,7 +1519,7 @@ bool AbstractStorageDecl::isFormallyResilient() const {
|
||||
// Private and (unversioned) internal variables always have a
|
||||
// fixed layout.
|
||||
if (!getFormalAccessScope(/*useDC=*/nullptr,
|
||||
/*respectVersionedAttr=*/true).isPublic())
|
||||
/*treatUsableFromInlineAsPublic=*/true).isPublic())
|
||||
return false;
|
||||
|
||||
// If we're an instance property of a nominal type, query the type.
|
||||
@@ -2204,28 +2204,31 @@ AccessLevel ValueDecl::getFormalAccessImpl(const DeclContext *useDC) const {
|
||||
return getFormalAccess();
|
||||
}
|
||||
|
||||
AccessScope ValueDecl::getFormalAccessScope(const DeclContext *useDC,
|
||||
bool respectVersionedAttr) const {
|
||||
AccessScope
|
||||
ValueDecl::getFormalAccessScope(const DeclContext *useDC,
|
||||
bool treatUsableFromInlineAsPublic) const {
|
||||
const DeclContext *result = getDeclContext();
|
||||
AccessLevel access = getFormalAccess(useDC, respectVersionedAttr);
|
||||
AccessLevel access = getFormalAccess(useDC, treatUsableFromInlineAsPublic);
|
||||
|
||||
while (!result->isModuleScopeContext()) {
|
||||
if (result->isLocalContext() || access == AccessLevel::Private)
|
||||
return AccessScope(result, true);
|
||||
|
||||
if (auto enclosingNominal = dyn_cast<NominalTypeDecl>(result)) {
|
||||
access = std::min(access,
|
||||
enclosingNominal->getFormalAccess(useDC,
|
||||
respectVersionedAttr));
|
||||
auto enclosingAccess =
|
||||
enclosingNominal->getFormalAccess(useDC,
|
||||
treatUsableFromInlineAsPublic);
|
||||
access = std::min(access, enclosingAccess);
|
||||
|
||||
} else if (auto enclosingExt = dyn_cast<ExtensionDecl>(result)) {
|
||||
// Just check the base type. If it's a constrained extension, Sema should
|
||||
// have already enforced access more strictly.
|
||||
if (auto extendedTy = enclosingExt->getExtendedType()) {
|
||||
if (auto nominal = extendedTy->getAnyNominal()) {
|
||||
access = std::min(access,
|
||||
nominal->getFormalAccess(useDC,
|
||||
respectVersionedAttr));
|
||||
auto nominalAccess =
|
||||
nominal->getFormalAccess(useDC,
|
||||
treatUsableFromInlineAsPublic);
|
||||
access = std::min(access, nominalAccess);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2332,7 +2335,7 @@ bool NominalTypeDecl::isFormallyResilient() const {
|
||||
// Private and (unversioned) internal types always have a
|
||||
// fixed layout.
|
||||
if (!getFormalAccessScope(/*useDC=*/nullptr,
|
||||
/*respectVersionedAttr=*/true).isPublic())
|
||||
/*treatUsableFromInlineAsPublic=*/true).isPublic())
|
||||
return false;
|
||||
|
||||
// Check for an explicit @_fixed_layout or @_frozen attribute.
|
||||
|
||||
Reference in New Issue
Block a user