in Generator/Sources/NeedleFramework/Parsing/Processors/ComponentInstantiationValidator.swift [48:69]
func process() throws {
// Enqueue validation tasks.
var handles = [SequenceExecutionHandle<ComponentInstantiationValidationResult>]()
for urlFileContent in urlFileContents {
let task = ComponentInstantiationValidationTask(urlFileContent: urlFileContent, componentNames: componentNames)
let handle = executor.executeSequence(from: task) { (_, result: Any) -> SequenceExecution<ComponentInstantiationValidationResult> in
SequenceExecution.endOfSequence(result as! ComponentInstantiationValidationResult)
}
handles.append(handle)
}
// Process validation results.
for handle in handles {
let result = try handle.await(withTimeout: timeout)
switch result {
case .success:
break
case .failure(let url, let componentName):
throw GenericError.withMessage("\(componentName) is instantiated incorrectly in \(url). All components must be instantiated by parent components, by passing `self` as the argument to the parent parameter.")
}
}
}