class RubyRunJs::OPCODES::NEW_NO_ARGS

Public Instance Methods

eval(ctx) click to toggle source
# File lib/ruby_run_js/opcodes.rb, line 729
def eval(ctx)
  constructor = ctx.stack.pop()
  if is_primitive(constructor) || !constructor.methods.include?(:construct)
    raise make_error('TypeError',
                      "#{constructor.js_class} is not a constructor")
  end
  ctx.stack.append(constructor.construct([]))
  nil
end