mutating func complete()

in SourceKitStressTester/Sources/SwiftCWrapper/SwiftCWrapper.swift [266:276]


  mutating func complete(_ item: T, at index: Int, setLast: Bool) {
    precondition(index < items.endIndex && items[index] == nil && nextItemIndex < items.endIndex)
    items[index] = item
    if setLast && (endIndex == nil || (index + 1) < endIndex!) {
      endIndex = index + 1
    }
    while nextItemIndex < (endIndex ?? items.endIndex), let nextItem = items[nextItemIndex] {
      completionHandler(nextItem)
      nextItemIndex += 1
    }
  }