mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[NFC] Adopt new ImportPath types and terminology
# Conflicts: # lib/IDE/CodeCompletion.cpp
This commit is contained in:
@@ -2014,35 +2014,31 @@ ModuleDecl *ModuleFile::getModule(ModuleID MID) {
|
||||
llvm_unreachable("implementation detail only");
|
||||
}
|
||||
}
|
||||
return getModule(getIdentifier(MID),
|
||||
return getModule(ImportPath::Module::Builder(getIdentifier(MID)).get(),
|
||||
getContext().LangOpts.AllowDeserializingImplementationOnly);
|
||||
}
|
||||
|
||||
ModuleDecl *ModuleFile::getModule(ArrayRef<Identifier> name,
|
||||
ModuleDecl *ModuleFile::getModule(ImportPath::Module name,
|
||||
bool allowLoading) {
|
||||
if (name.empty() || name.front().empty())
|
||||
if (name.empty() || name.front().Item.empty())
|
||||
return getContext().TheBuiltinModule;
|
||||
|
||||
// FIXME: duplicated from ImportResolver::getModule
|
||||
if (name.size() == 1 &&
|
||||
name.front() == FileContext->getParentModule()->getName()) {
|
||||
name.front().Item == FileContext->getParentModule()->getName()) {
|
||||
if (!UnderlyingModule && allowLoading) {
|
||||
auto importer = getContext().getClangModuleLoader();
|
||||
assert(importer && "no way to import shadowed module");
|
||||
UnderlyingModule = importer->loadModule(SourceLoc(),
|
||||
{{name.front(), SourceLoc()}});
|
||||
UnderlyingModule =
|
||||
importer->loadModule(SourceLoc(), name.getTopLevelPath());
|
||||
}
|
||||
|
||||
return UnderlyingModule;
|
||||
}
|
||||
|
||||
SmallVector<ImportDecl::AccessPathElement, 4> importPath;
|
||||
for (auto pathElem : name)
|
||||
importPath.push_back({ pathElem, SourceLoc() });
|
||||
|
||||
if (allowLoading)
|
||||
return getContext().getModule(importPath);
|
||||
return getContext().getLoadedModule(importPath);
|
||||
return getContext().getModule(name);
|
||||
return getContext().getLoadedModule(name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user