class Opal::Nodes::MassAssignNode

def compile

def compile
  array = scope.new_temp
  if rhs.type == :array
    push "#{array} = ", expr(rhs)
    compile_masgn(lhs.children, array, rhs.size - 1)
    push ", #{array}" # a mass assignment evaluates to the RHS
  elsif rhs.type == :to_ary
    retval = scope.new_temp
    push "#{retval} = ", expr(rhs[1])
    push ", #{array} = Opal.to_ary(#{retval})"
    compile_masgn(lhs.children, array)
    push ", #{retval}"
    scope.queue_temp(retval)
  elsif rhs.type == :splat
    push "#{array} = Opal.to_a(", expr(rhs[1]), ")"
    compile_masgn(lhs.children, array)
    push ", #{array}"
  else
    raise "unsupported mlhs type"
  end
  scope.queue_temp(array)
end