Split getAccessibility() into getFormalAccess() and getEffectiveAccess().

Currently a no-op, but effective access for entities within the current
module will soon need to take testability into account. This declaration:

  internal func foo() {}

has a formal access of 'internal', but an effective access of 'public' if
we're in a testable mode.

Part of rdar://problem/17732115 (testability)

Swift SVN r26472
This commit is contained in:
Jordan Rose
2015-03-24 02:16:58 +00:00
parent dac0dc1dad
commit f74bc7122c
33 changed files with 162 additions and 161 deletions

View File

@@ -479,7 +479,7 @@ void Module::lookupMember(SmallVectorImpl<ValueDecl*> &results,
});
alreadyInPrivateContext =
(nominal->getAccessibility() == Accessibility::Private);
(nominal->getFormalAccess() == Accessibility::Private);
break;
}
@@ -495,14 +495,14 @@ void Module::lookupMember(SmallVectorImpl<ValueDecl*> &results,
} else if (privateDiscriminator.empty()) {
auto newEnd = std::remove_if(results.begin()+oldSize, results.end(),
[](const ValueDecl *VD) -> bool {
return VD->getAccessibility() <= Accessibility::Private;
return VD->getFormalAccess() <= Accessibility::Private;
});
results.erase(newEnd, results.end());
} else {
auto newEnd = std::remove_if(results.begin()+oldSize, results.end(),
[=](const ValueDecl *VD) -> bool {
if (VD->getAccessibility() > Accessibility::Private)
if (VD->getFormalAccess() > Accessibility::Private)
return true;
auto enclosingFile =
cast<FileUnit>(VD->getDeclContext()->getModuleScopeContext());