class RuboCop::AST::NodePattern::Builder

def union_children(pattern_lists)

def union_children(pattern_lists)
  if pattern_lists.size == 1 # {a b c} => [[a, b, c]] => [a, b, c]
    children = pattern_lists.first
    raise NodePattern::Invalid, 'A union can not be empty' if children.empty?
    children
  else # { a b | c } => [[a, b], [c]] => [s(:subsequence, a, b), c]
    pattern_lists.map do |list|
      emit_subsequence(list)
    end
  end
end