Skip to content

Commit 5385fae

Browse files
author
David Ungar
committed
Standardize on singular
1 parent bc03636 commit 5385fae

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

Sources/SwiftDriver/Jobs/Planning.swift

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,8 @@ extension Driver {
3939
func addJob(_ j: Job) {
4040
jobs.append(j)
4141
}
42-
func addJobs(_ js: [Job]) {
43-
jobs.append(contentsOf: js)
44-
}
4542

46-
try addPrecompileModuleDependenciesJobs(addJobs: addJobs)
43+
try addPrecompileModuleDependenciesJobs(addJob: addJob)
4744
try addPrecompileBridgingHeaderJob(addJob: addJob)
4845
try addEmitModuleJob(addJob: addJob)
4946

@@ -55,7 +52,7 @@ extension Driver {
5552
}
5653

5754

58-
private mutating func addPrecompileModuleDependenciesJobs(addJobs: ([Job]) -> Void) throws {
55+
private mutating func addPrecompileModuleDependenciesJobs(addJob: (Job) -> Void) throws {
5956
// If asked, add jobs to precompile module dependencies
6057
guard parsedOptions.contains(.driverExplicitModuleBuild) ||
6158
parsedOptions.contains(.driverPrintModuleDependenciesJobs)
@@ -64,7 +61,7 @@ extension Driver {
6461
}
6562
let modulePrebuildJobs = try generateExplicitModuleBuildJobs()
6663
if parsedOptions.contains(.driverExplicitModuleBuild) {
67-
addJobs(modulePrebuildJobs)
64+
modulePrebuildJobs.forEach(addJob)
6865
}
6966

7067
// If we've been asked to prebuild module dependencies,
@@ -104,7 +101,6 @@ extension Driver {
104101

105102
var linkerInputs = [TypedVirtualPath]()
106103
func addLinkerInput(_ li: TypedVirtualPath) { linkerInputs.append(li) }
107-
func addLinkerInputs(_ lis: [TypedVirtualPath]) { linkerInputs.append(contentsOf: lis) }
108104

109105
var moduleInputs = [TypedVirtualPath]()
110106
func addModuleInput(_ mi: TypedVirtualPath) { moduleInputs.append(mi) }
@@ -119,7 +115,7 @@ extension Driver {
119115
addLinkerInput(jobOutput)
120116

121117
case .swiftModule:
122-
moduleInputsFromJobOutputs.append(jobOutput)
118+
addModuleInputFromJobOutputs(jobOutput)
123119

124120
default:
125121
break
@@ -137,7 +133,7 @@ extension Driver {
137133
addJobOutputs: addJobOutputs)
138134

139135
try addAutolinkExtractJob(linkerInputs: linkerInputs,
140-
addLinkerInputs: addLinkerInputs,
136+
addLinkerInput: addLinkerInput,
141137
addJob: addJob)
142138

143139
if let mergeJob = try mergeModuleJob(
@@ -149,7 +145,7 @@ extension Driver {
149145
mergeJob: mergeJob,
150146
debugInfo: debugInfo,
151147
addJob: addJob,
152-
addLinkerInputs: addLinkerInputs)
148+
addLinkerInput: addLinkerInput)
153149
}
154150
return linkerInputs
155151
}
@@ -317,21 +313,21 @@ extension Driver {
317313

318314
private mutating func addAutolinkExtractJob(
319315
linkerInputs: [TypedVirtualPath],
320-
addLinkerInputs: ([TypedVirtualPath]) -> Void,
316+
addLinkerInput: (TypedVirtualPath) -> Void,
321317
addJob: (Job) -> Void)
322318
throws
323319
{
324320
let autolinkInputs = linkerInputs.filter { $0.type == .object }
325321
if let autolinkExtractJob = try autolinkExtractJob(inputs: autolinkInputs) {
326322
addJob(autolinkExtractJob)
327-
addLinkerInputs(autolinkExtractJob.outputs)
323+
autolinkExtractJob.outputs.forEach(addLinkerInput)
328324
}
329325
}
330326

331327
private mutating func addWrapJobOrMergeOutputs(mergeJob: Job,
332328
debugInfo: DebugInfo,
333329
addJob: (Job) -> Void,
334-
addLinkerInputs: ([TypedVirtualPath]) -> Void)
330+
addLinkerInput: (TypedVirtualPath) -> Void)
335331
throws {
336332
guard case .astTypes = debugInfo.level
337333
else { return }
@@ -342,9 +338,9 @@ extension Driver {
342338
"Merge module job should only have one swiftmodule output")
343339
let wrapJob = try moduleWrapJob(moduleInput: mergeModuleOutputs[0])
344340
addJob(wrapJob)
345-
addLinkerInputs(wrapJob.outputs)
341+
wrapJob.outputs.forEach(addLinkerInput)
346342
} else {
347-
addLinkerInputs(mergeJob.outputs)
343+
mergeJob.outputs.forEach(addLinkerInput)
348344
}
349345
}
350346

0 commit comments

Comments
 (0)