Sha256: 9cc7658018c183011ce310facf970eb58ea64f6e4374cf412463167f016d95df

Contents?: true

Size: 1.78 KB

Versions: 37

Compression:

Stored size: 1.78 KB

Contents

#include "rr.h"

namespace rr {
  void Function::Init() {
    ClassBuilder("Function", Object::Class).
      defineMethod("NewInstance", &NewInstance).
      defineMethod("Call", &Call).
      defineMethod("SetName", &SetName).
      defineMethod("GetName", &GetName).
      defineMethod("GetInferredName", &GetInferredName).
      defineMethod("GetScriptLineNumber", &GetScriptLineNumber).
      defineMethod("GetScriptColumnNumber", &GetScriptColumnNumber).
      defineMethod("GetScriptId", &GetScriptId).
      defineMethod("GetScriptOrigin", &GetScriptOrigin).
      store(&Class);
  }

  VALUE Function::NewInstance(int argc, VALUE argv[], VALUE self) {
    VALUE args;
    rb_scan_args(argc,argv,"01", &args);
    if (RTEST(args)) {
      return Object(Function(self)->NewInstance(RARRAY_LENINT(args), Value::array<Value>(args)));
    } else {
      return Object(Function(self)->NewInstance());
    }
  }
  VALUE Function::Call(VALUE self, VALUE receiver, VALUE argv) {
    return Value(Function(self)->Call(Object(receiver), RARRAY_LENINT(argv), Value::array<Value>(argv)));
  }

  VALUE Function::SetName(VALUE self, VALUE name) {
    Void(Function(self)->SetName(String(name)));
  }

  VALUE Function::GetName(VALUE self) {
    return Value(Function(self)->GetName());
  }

  VALUE Function::GetInferredName(VALUE self) {
    return Value(Function(self)->GetInferredName());
  }

  VALUE Function::GetScriptLineNumber(VALUE self) {
    return INT2FIX(Function(self)->GetScriptLineNumber());
  }

  VALUE Function::GetScriptColumnNumber(VALUE self) {
    return INT2FIX(Function(self)->GetScriptColumnNumber());
  }

  VALUE Function::GetScriptId(VALUE self) {
    return Value(Function(self)->GetScriptId());
  }

  VALUE Function::GetScriptOrigin(VALUE self) {
    return not_implemented("GetScriptOrigin");
  }
}

Version data entries

37 entries across 37 versions & 8 rubygems

Version Path
arcabouco-0.2.13 vendor/bundle/gems/therubyracer-0.12.2/ext/v8/function.cc
therubyracer-0.12.3 ext/v8/function.cc
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/therubyracer-0.11.4/ext/v8/function.cc
therubyracer-xcode-0.12.3 ext/v8/function.cc
therubyracer-xcode-0.12.2 ext/v8/function.cc
therubyracer-tmpfork-0.12.2 ext/v8/function.cc
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/therubyracer-0.12.2/ext/v8/function.cc
therubyracer-0.12.2 ext/v8/function.cc
therubyracer-0.12.1 ext/v8/function.cc
therubyracer-discourse-0.12.0 ext/v8/function.cc
therubyracer-0.12.0 ext/v8/function.cc
therubyracer-0.11.4 ext/v8/function.cc
therubyracer-0.11.3 ext/v8/function.cc
therubyracer-0.11.2 ext/v8/function.cc
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/therubyracer-0.11.0/ext/v8/function.cc
therubyracer-0.11.1 ext/v8/function.cc
therubyracer-0.11.1beta1 ext/v8/function.cc
therubyracer-0.11.0 ext/v8/function.cc
therubyracer-0.11.0beta8-x86-freebsd-9 ext/v8/function.cc
therubyracer-0.11.0beta8-x86_64-linux ext/v8/function.cc