class Opal::Nodes::MassAssignNode

def compile_assignment(child, array, idx, len = nil)

def compile_assignment(child, array, idx, len = nil)
  assign =
    if !len || idx >= len
      s(:js_tmp, "(#{array}[#{idx}] == null ? nil : #{array}[#{idx}])")
    else
      s(:js_tmp, "#{array}[#{idx}]")
    end
  part = child.updated
  if SIMPLE_ASSIGNMENT.include?(child.type)
    part = part.updated(nil, part.children + [assign])
  elsif child.type == :send
    part = part.updated(nil, part.children + [assign])
  elsif child.type == :attrasgn
    part.last << assign
  elsif child.type == :mlhs
    helper :to_ary
    # nested destructuring
    tmp = scope.new_temp
    push ", (#{tmp} = $to_ary(#{assign.children[0]})"
    compile_masgn(child.children, tmp)
    push ')'
    scope.queue_temp(tmp)
    return
  else
    raise "Bad child node in masgn LHS: #{child}. LHS: #{lhs}"
  end
  push ', '
  push expr(part)
end