class RubyRunJs::OPCODES::POSTFIX_MEMBER

Public Class Methods

new(post, incr) click to toggle source
# File lib/ruby_run_js/opcodes.rb, line 86
def initialize(post, incr)
  @cb = incr ? 1 : -1
  @ca = post ? -@cb : 0
end

Public Instance Methods

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

  target = to_number(get_member(left, name, ctx.builtin)) + @cb
  if left.js_type == :Object
    left.put(name, target)
  end

  ctx.stack.append(target + @ca)
  nil
 end