class Unparser::Writer::Array

def array_elements_generic_type

def array_elements_generic_type
  children_types = children.to_set(&:type)
  if children_types == Set[:sym, :dsym]
    :dsym
  elsif children_types == Set[:str, :dstr]
    :dstr
  elsif children_types == Set[]
    :sym
  else
    Util.one(children_types.to_a)
  end
end

def emit_compact # rubocop:disable Metrics/AbcSize

rubocop:disable Metrics/AbcSize
def emit_compact # rubocop:disable Metrics/AbcSize
  children_generic_type = array_elements_generic_type
  write(MAP.fetch(children_generic_type))
  parentheses('[', ']') do
    delimited(children, ' ') do |child|
      if n_sym?(child) || n_str?(child)
        write(Util.one(child.children).to_s)
      else
        write('#{')
        emitter(Util.one(Util.one(child.children).children)).write_to_buffer
        write('}')
      end
    end
  end
end