class RubyRunJs::OPCODES::STORE_MEMBER_DOT

Public Class Methods

new(prop) click to toggle source
# File lib/ruby_run_js/opcodes.rb, line 512
def initialize(prop)
  @prop = prop
end

Public Instance Methods

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

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