@@ -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
@@ -1253,13 +1253,13 @@ getPrivateDeclContext(const DeclContext *DC, const SourceFile *useSF) {
1253
1253
1254
1254
// use the type declaration as the private scope if it is in the same
1255
1255
// file as useSF. This occurs for both extensions and declarations.
1256
- if (NTD->getParentSourceFile () == useSF)
1256
+ if (NTD->getOutermostParentSourceFile () == useSF)
1257
1257
return NTD;
1258
1258
1259
1259
// Otherwise use the last extension declaration in the same file.
1260
1260
const DeclContext *lastExtension = nullptr ;
1261
1261
for (ExtensionDecl *ED : NTD->getExtensions ())
1262
- if (ED->getParentSourceFile () == useSF)
1262
+ if (ED->getOutermostParentSourceFile () == useSF)
1263
1263
lastExtension = ED;
1264
1264
1265
1265
// If there's no last extension, return the supplied context.
@@ -1269,7 +1269,7 @@ getPrivateDeclContext(const DeclContext *DC, const SourceFile *useSF) {
1269
1269
AccessScope::AccessScope (const DeclContext *DC, bool isPrivate)
1270
1270
: Value(DC, isPrivate) {
1271
1271
if (isPrivate) {
1272
- DC = getPrivateDeclContext (DC, DC->getParentSourceFile ());
1272
+ DC = getPrivateDeclContext (DC, DC->getOutermostParentSourceFile ());
1273
1273
Value.setPointer (DC);
1274
1274
}
1275
1275
if (!DC || isa<ModuleDecl>(DC) || isa<PackageUnit>(DC))
@@ -1319,8 +1319,8 @@ bool AccessScope::allowsPrivateAccess(const DeclContext *useDC, const DeclContex
1319
1319
}
1320
1320
}
1321
1321
// Do not allow access if the sourceDC is in a different file
1322
- auto useSF = useDC->getParentSourceFile ();
1323
- if (useSF != sourceDC->getParentSourceFile ())
1322
+ auto useSF = useDC->getOutermostParentSourceFile ();
1323
+ if (useSF != sourceDC->getOutermostParentSourceFile ())
1324
1324
return false ;
1325
1325
1326
1326
// Do not allow access if the sourceDC does not represent a type.
0 commit comments