mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SR-2209] Make a real AccessScope class and use it in access checking.
1. Add new AccessScope type that just wraps a plain DeclContext. 2. Propagate it into all uses of "ValueDecl::getFormalAccessScope". 3. Turn all operations that combine access scopes into methods on AccessScope. 4. Add the "private" flag to distinguish "private" from "fileprivate" scope for top-level DeclContext.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "swift/AST/Module.h"
|
||||
#include "swift/AST/AccessScope.h"
|
||||
#include "swift/AST/AST.h"
|
||||
#include "swift/AST/ASTPrinter.h"
|
||||
#include "swift/AST/ASTScope.h"
|
||||
@@ -428,8 +429,8 @@ void Module::lookupMember(SmallVectorImpl<ValueDecl*> &results,
|
||||
return VD->getModuleContext() == this;
|
||||
});
|
||||
|
||||
const DeclContext *accessScope = nominal->getFormalAccessScope();
|
||||
if (accessScope && !accessScope->isModuleContext())
|
||||
auto AS = nominal->getFormalAccessScope();
|
||||
if (AS.isPrivate() || AS.isFileScope())
|
||||
alreadyInPrivateContext = true;
|
||||
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user