class RubyRunJs::OPCODES::STORE_MEMBER_DOT_OP
Public Class Methods
new(prop, op)
click to toggle source
# File lib/ruby_run_js/opcodes.rb, line 587 def initialize(prop, op) @prop = prop @op = op end
Public Instance Methods
eval(ctx)
click to toggle source
# File lib/ruby_run_js/opcodes.rb, line 592 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 ctx.stack.append(binary_operation(@op, get_member(left, @prop, ctx.builtin), value)) else ctx.stack.append(binary_operation(@op, get_member(left, @prop, ctx.builtin), value)) left.put(@prop, ctx.stack[-1]) end nil end