Skip to content

Commit 47c943d

Browse files
committed
Code cleanup according to code-review feedback
1 parent 03e994b commit 47c943d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

Sources/SwiftDriver/Explicit Module Builds/PlaceholderDependencyResolution.swift

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,9 @@ import Foundation
6969
while !placeholderModules.isEmpty {
7070
let moduleId = placeholderModules.first!
7171
let swiftModuleId = ModuleDependencyId.swift(moduleId.moduleName)
72-
73-
guard dependencyOracle.getModuleInfo(of: swiftModuleId) != nil else {
72+
guard let moduleInfo = dependencyOracle.getModuleInfo(of: swiftModuleId) else {
7473
throw Driver.Error.missingExternalDependency(moduleId.moduleName)
7574
}
76-
let moduleInfo = dependencyOracle.getModuleInfo(of: swiftModuleId)!
7775

7876
// Insert the resolved module, replacing the placeholder.
7977
try Self.mergeModule(swiftModuleId, moduleInfo, into: &modules)
@@ -111,17 +109,18 @@ fileprivate extension InterModuleDependencyGraph {
111109
// in the multi-module build planning context.
112110
let swiftModuleId = ModuleDependencyId.swift(placeholderId.moduleName)
113111
let swiftPrebuiltModuleId = ModuleDependencyId.swiftPrebuiltExternal(placeholderId.moduleName)
114-
115112
let externalModuleId: ModuleDependencyId
116-
if dependencyOracle.getModuleInfo(of: swiftModuleId) != nil {
113+
let externalModuleInfo: ModuleInfo
114+
if let moduleInfo = dependencyOracle.getModuleInfo(of: swiftModuleId) {
117115
externalModuleId = swiftModuleId
118-
} else if dependencyOracle.getModuleInfo(of: swiftPrebuiltModuleId) != nil {
116+
externalModuleInfo = moduleInfo
117+
} else if let prebuiltModuleInfo = dependencyOracle.getModuleInfo(of: swiftPrebuiltModuleId) {
119118
externalModuleId = swiftPrebuiltModuleId
119+
externalModuleInfo = prebuiltModuleInfo
120120
} else {
121121
throw Driver.Error.missingExternalDependency(placeholderId.moduleName)
122122
}
123123

124-
let externalModuleInfo = dependencyOracle.getModuleInfo(of: externalModuleId)!
125124
let newExternalModuleDetails =
126125
SwiftPrebuiltExternalModuleDetails(compiledModulePath: placeholderPath.description)
127126
let newInfo = ModuleInfo(modulePath: placeholderPath.description,

0 commit comments

Comments
 (0)