class RubyRunJs::OPCODES::POSTFIX

Public Class Methods

new(post, incr, identifier) click to toggle source
# File lib/ruby_run_js/opcodes.rb, line 69
def initialize(post, incr, identifier)
  @identifier = identifier
  @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 75
def eval(ctx)
  target = to_number(ctx.get_binding_value(@identifier)) + @cb
  ctx.set_binding(@identifier, target)
  ctx.stack.append(target + @ca)
  nil
end