Create PackageUnit class, and Package entries to DeclContext / ASTHierarchy

Previously enum AccessLimitKind was
added to distinguish access scopes b/t package and public while keeping
DeclContext null but it proved to be too limiting. This PR creates package specific entries for DeclContext and
ASTHierarchy. It create a new class PackageUnit that can be set as the parent DeclContext of ModuleDecl. This PR
contains addition of such entries but not the use of them; the actual use of them will be in the upcoming PRs.

Resolves rdar://106155600
This commit is contained in:
Ellie Shin
2023-03-02 10:17:20 -08:00
parent fbac54546d
commit 7d23db3646
21 changed files with 129 additions and 13 deletions

View File

@@ -1198,6 +1198,8 @@ static Optional<AccessLevel> inferAccessSyntactically(const ValueDecl *D) {
case DeclContextKind::AbstractFunctionDecl:
case DeclContextKind::SubscriptDecl:
return AccessLevel::Private;
case DeclContextKind::Package:
return AccessLevel::Package;
case DeclContextKind::Module:
case DeclContextKind::FileUnit:
case DeclContextKind::MacroDecl: