mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[NFC] Hide LoadedModules From Clients of ASTContext
There's no reason clients need to be able to access this data directly. It obscures where module loading is actually happening, and makes it too easy to accidentally register a module with the wrong identifier in the context. Hide the registration operations behind opaque accessors.
This commit is contained in:
@@ -959,7 +959,7 @@ SerializedModuleLoaderBase::loadModule(SourceLoc importLoc,
|
||||
|
||||
auto M = ModuleDecl::create(moduleID.Item, Ctx);
|
||||
M->setIsSystemModule(isSystemModule);
|
||||
Ctx.LoadedModules[moduleID.Item] = M;
|
||||
Ctx.addLoadedModule(M);
|
||||
SWIFT_DEFER { M->setHasResolvedImports(); };
|
||||
|
||||
StringRef moduleInterfacePathStr =
|
||||
@@ -1010,7 +1010,7 @@ MemoryBufferSerializedModuleLoader::loadModule(SourceLoc importLoc,
|
||||
return nullptr;
|
||||
|
||||
M->addFile(*file);
|
||||
Ctx.LoadedModules[moduleID.Item] = M;
|
||||
Ctx.addLoadedModule(M);
|
||||
return M;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user