@@ -83,13 +83,14 @@ extension ModuleDependencyGraph {
83
83
// MARK: - Getting a graph read from priors ready to use
84
84
extension ModuleDependencyGraph {
85
85
func collectNodesInvalidatedByChangedOrAddedExternals( ) -> Set < Node > {
86
- let invalidatedNodes = fingerprintedExternalDependencies. lazy. flatMap {
87
- self . collectNodesInvalidatedByProcessing ( fingerprintedExternalDependency: $0,
88
- includeAddedExternals: true )
86
+ fingerprintedExternalDependencies. reduce ( into: Set ( ) ) { invalidatedNodes, fed in
87
+ invalidatedNodes. formUnion (
88
+ self . collectNodesInvalidatedByProcessing ( fingerprintedExternalDependency: fed,
89
+ includeAddedExternals: true ) )
89
90
}
90
- return Set ( invalidatedNodes)
91
91
}
92
92
}
93
+
93
94
// MARK: - Scheduling the first wave
94
95
extension ModuleDependencyGraph {
95
96
/// Find all the sources that depend on `sourceFile`. For some source files, these will be
@@ -179,11 +180,13 @@ extension ModuleDependencyGraph {
179
180
in: self ,
180
181
diagnosticEngine: info. diagnosticEngine)
181
182
. tracedUses
182
- let invalidatedSources = Set (
183
- affectedNodes. compactMap {
184
- $0. dependencySource. flatMap { $0. typedFile. type == . swiftDeps ? $0 : nil }
185
- } )
186
- return invalidatedSources
183
+ return affectedNodes. reduce ( into: Set ( ) ) {
184
+ invalidatedSources, affectedNode in
185
+ if let source = affectedNode. dependencySource,
186
+ source. typedFile. type == . swiftDeps {
187
+ invalidatedSources. insert ( source)
188
+ }
189
+ }
187
190
}
188
191
189
192
/// Given an external dependency & its fingerprint, find any nodes directly using that dependency.
@@ -248,10 +251,10 @@ extension ModuleDependencyGraph {
248
251
func collectInputsUsingTransitivelyInvalidated(
249
252
nodes invalidatedNodes: Set < Node >
250
253
) -> Set < TypedVirtualPath > {
251
- let invalidatedInputs =
252
- collectSwiftDepsUsingTransitivelyInvalidated ( nodes : invalidatedNodes ) . lazy
253
- . map ( getInput ( for: ) )
254
- return Set ( invalidatedInputs )
254
+ collectSwiftDepsUsingTransitivelyInvalidated ( nodes : invalidatedNodes )
255
+ . reduce ( into : Set ( ) ) { invalidatedInputs , invalidatedSwiftDeps in
256
+ invalidatedInputs . insert ( getInput ( for: invalidatedSwiftDeps ) )
257
+ }
255
258
}
256
259
}
257
260
0 commit comments