mutating func nodes()

in Sources/SwiftFormatRules/OneVariableDeclarationPerLine.swift [133:155]


  mutating func nodes(bySplitting varDecl: VariableDeclSyntax) -> [Node] {
    self.varDecl = varDecl
    self.nodes = []

    for binding in varDecl.bindings {
      if binding.initializer != nil {
        // If this is the only initializer in the queue so far, that's ok. If
        // it's an initializer following other un-flushed lone identifier
        // bindings, that's not valid Swift. But in either case, we'll flush
        // them as a single decl.
        bindingQueue.append(binding.withTrailingComma(nil))
        flushRemaining()
      } else if let typeAnnotation = binding.typeAnnotation {
        bindingQueue.append(binding)
        flushIndividually(typeAnnotation: typeAnnotation)
      } else {
        bindingQueue.append(binding)
      }
    }
    flushRemaining()

    return nodes
  }