@@ -407,7 +407,7 @@ DeclContext *DeclContext::getModuleScopeContext() const {
407
407
408
408
void DeclContext::getSeparatelyImportedOverlays (
409
409
ModuleDecl *declaring, SmallVectorImpl<ModuleDecl *> &overlays) const {
410
- if (auto SF = getParentSourceFile ())
410
+ if (auto SF = getOutermostParentSourceFile ())
411
411
SF->getSeparatelyImportedOverlays (declaring, overlays);
412
412
}
413
413
@@ -1234,13 +1234,13 @@ getPrivateDeclContext(const DeclContext *DC, const SourceFile *useSF) {
1234
1234
1235
1235
// use the type declaration as the private scope if it is in the same
1236
1236
// file as useSF. This occurs for both extensions and declarations.
1237
- if (NTD->getParentSourceFile () == useSF)
1237
+ if (NTD->getOutermostParentSourceFile () == useSF)
1238
1238
return NTD;
1239
1239
1240
1240
// Otherwise use the last extension declaration in the same file.
1241
1241
const DeclContext *lastExtension = nullptr ;
1242
1242
for (ExtensionDecl *ED : NTD->getExtensions ())
1243
- if (ED->getParentSourceFile () == useSF)
1243
+ if (ED->getOutermostParentSourceFile () == useSF)
1244
1244
lastExtension = ED;
1245
1245
1246
1246
// If there's no last extension, return the supplied context.
@@ -1250,7 +1250,7 @@ getPrivateDeclContext(const DeclContext *DC, const SourceFile *useSF) {
1250
1250
AccessScope::AccessScope (const DeclContext *DC, bool isPrivate)
1251
1251
: Value(DC, isPrivate) {
1252
1252
if (isPrivate) {
1253
- DC = getPrivateDeclContext (DC, DC->getParentSourceFile ());
1253
+ DC = getPrivateDeclContext (DC, DC->getOutermostParentSourceFile ());
1254
1254
Value.setPointer (DC);
1255
1255
}
1256
1256
if (!DC || isa<ModuleDecl>(DC) || isa<PackageUnit>(DC))
@@ -1300,8 +1300,8 @@ bool AccessScope::allowsPrivateAccess(const DeclContext *useDC, const DeclContex
1300
1300
}
1301
1301
}
1302
1302
// Do not allow access if the sourceDC is in a different file
1303
- auto useSF = useDC->getParentSourceFile ();
1304
- if (useSF != sourceDC->getParentSourceFile ())
1303
+ auto useSF = useDC->getOutermostParentSourceFile ();
1304
+ if (useSF != sourceDC->getOutermostParentSourceFile ())
1305
1305
return false ;
1306
1306
1307
1307
// Do not allow access if the sourceDC does not represent a type.
0 commit comments