mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #32754 from artemcm/CanImportExplicitly
[Explicit Module Builds] Add canImport functionality to the ExplicitSwiftModuleLoader
This commit is contained in:
@@ -1616,6 +1616,17 @@ std::error_code ExplicitSwiftModuleLoader::findModuleFilesInDirectory(
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
bool ExplicitSwiftModuleLoader::canImportModule(
|
||||
Located<Identifier> mID) {
|
||||
StringRef moduleName = mID.Item.str();
|
||||
auto it = Impl.ExplicitModuleMap.find(moduleName);
|
||||
// If no provided explicit module matches the name, then it cannot be imported.
|
||||
if (it == Impl.ExplicitModuleMap.end()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void ExplicitSwiftModuleLoader::collectVisibleTopLevelModuleNames(
|
||||
SmallVectorImpl<Identifier> &names) const {
|
||||
for (auto &entry: Impl.ExplicitModuleMap) {
|
||||
|
||||
Reference in New Issue
Block a user