@@ -58,15 +58,16 @@ import SwiftOptions
58
58
function: String = #function,
59
59
file: String = #file,
60
60
line: Int = #line) -> DependencySource {
61
- guard let source = inputDependencySourceMap [ input] else {
61
+ guard let source = inputDependencySourceMap. getSource ( for: input)
62
+ else {
62
63
fatalError ( " \( input. file. basename) not found in inputDependencySourceMap, \( file) : \( line) in \( function) " )
63
64
}
64
65
return source
65
66
}
66
67
@_spi ( Testing) public func getInput( for source: DependencySource ) -> TypedVirtualPath ? {
67
68
guard let input =
68
69
info. simulateGetInputFailure ? nil
69
- : inputDependencySourceMap [ source]
70
+ : inputDependencySourceMap. getInput ( for : source)
70
71
else {
71
72
info. diagnosticEngine. emit ( warning: " Failed to find source file for ' \( source. file. basename) ', recovering with a full rebuild. Next build will be incremental. " )
72
73
info. reporter? . report (
@@ -172,10 +173,10 @@ extension ModuleDependencyGraph {
172
173
return allDependencySourcesToRecompile. compactMap {
173
174
depedencySource in
174
175
guard depedencySource != changedSource else { return nil }
175
- let dependentSource = inputDependencySourceMap [ depedencySource]
176
+ let dependentInput = inputDependencySourceMap. getInput ( for : depedencySource)
176
177
info. reporter? . report (
177
- " Found dependent of \( input. file. basename) : " , dependentSource )
178
- return dependentSource
178
+ " Found dependent of \( input. file. basename) : " , dependentInput )
179
+ return dependentInput
179
180
}
180
181
}
181
182
@@ -192,7 +193,7 @@ extension ModuleDependencyGraph {
192
193
/// Does the graph contain any dependency nodes for a given source-code file?
193
194
func containsNodes( forSourceFile file: TypedVirtualPath ) -> Bool {
194
195
precondition ( file. type == . swift)
195
- guard let source = inputDependencySourceMap [ file] else {
196
+ guard let source = inputDependencySourceMap. getSource ( for : file) else {
196
197
return false
197
198
}
198
199
return containsNodes ( forDependencySource: source)
@@ -803,7 +804,7 @@ extension ModuleDependencyGraph {
803
804
}
804
805
}
805
806
806
- for ( input, dependencySource) in graph . inputDependencySourceMap {
807
+ graph . inputDependencySourceMap . enumerateToSerialize { input, dependencySource in
807
808
self . addIdentifier ( input. file. name)
808
809
self . addIdentifier ( dependencySource. file. name)
809
810
}
@@ -948,7 +949,8 @@ extension ModuleDependencyGraph {
948
949
}
949
950
}
950
951
}
951
- for (input, dependencySource) in graph. inputDependencySourceMap {
952
+ graph. inputDependencySourceMap. enumerateToSerialize {
953
+ input, dependencySource in
952
954
serializer. stream. writeRecord ( serializer. abbreviations [ . mapNode] !) {
953
955
$0. append ( RecordID . mapNode)
954
956
$0. append ( serializer. lookupIdentifierCode ( for: input. file. name) )
0 commit comments