class RubyRunJs::OPCODES::STORE_MEMBER

Public Instance Methods

eval(ctx) click to toggle source
# File lib/ruby_run_js/opcodes.rb, line 484
def eval(ctx)
  value = ctx.stack.pop()
  name = ctx.stack.pop()
  left = ctx.stack.pop()

  name = to_string(name)

  if is_primitive(left)
    if left.js_type == :Null
        raise make_error('TypeError',
                        "Cannot set property '#{name}' of null")
    elsif left.js_type == :Undefined
        raise make_error('TypeError',
                        "Cannot set property '#{name}' of undefined")
    end
    # just ignore...
  else
    left.put(name, value)
  end
  ctx.stack.append(value)
  nil
end