module RubyRunJs::OPCODES

Public Class Methods

bytecode_call(ctx, func, this, args) click to toggle source

————— CALLS ————–

# File lib/ruby_run_js/opcodes.rb, line 615
def self.bytecode_call(ctx, func, this, args)
  if func.js_class != 'Function'
    raise make_error('TypeError', "#{func.js_class} is not a function")
  end
  if func.is_native  # call to built-in function or method
    ctx.stack.append(func.call(this, args))
    return nil
  end
  # therefore not native. we have to return [new_context, function_label] to instruct interpreter to call
  return func.generate_my_scope(this, args), func.code
end