mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
add stub for Object::SetAccessor()
This commit is contained in:
parent
dd12601032
commit
28475caab3
3 changed files with 13 additions and 2 deletions
|
@ -11,7 +11,8 @@ void Object::Init() {
|
|||
defineMethod("GetPropertyAttributes", &GetPropertyAttributes).
|
||||
defineMethod("Has", &Has).
|
||||
defineMethod("Delete", &Delete).
|
||||
defineMethod("ForceDelete", &ForceDelete);
|
||||
defineMethod("ForceDelete", &ForceDelete).
|
||||
defineMethod("SetAccessor", &SetAccessor);
|
||||
ClassBuilder("PropertyAttribute").
|
||||
defineEnumConst("None", v8::None).
|
||||
defineEnumConst("ReadOnly", v8::ReadOnly).
|
||||
|
|
|
@ -23,7 +23,10 @@ namespace rr {
|
|||
VALUE superclass = defineClass(supername);
|
||||
this->value = defineClass(name, superclass);
|
||||
}
|
||||
|
||||
ClassBuilder& ClassBuilder::defineMethod(const char* name, VALUE (*impl)(int, VALUE*, VALUE)) {
|
||||
rb_define_method(this->value, name, (VALUE (*)(...))impl, -1);
|
||||
return *this;
|
||||
}
|
||||
ClassBuilder& ClassBuilder::defineMethod(const char* name, VALUE (*impl)(VALUE)) {
|
||||
rb_define_method(this->value, name, (VALUE (*)(...))impl, 0);
|
||||
return *this;
|
||||
|
@ -36,6 +39,10 @@ namespace rr {
|
|||
rb_define_method(this->value, name, (VALUE (*)(...))impl, 2);
|
||||
return *this;
|
||||
}
|
||||
ClassBuilder& ClassBuilder::defineSingletonMethod(const char* name, VALUE (*impl)(int, VALUE*, VALUE)) {
|
||||
rb_define_singleton_method(this->value, name, (VALUE (*)(...))impl, -1);
|
||||
return *this;
|
||||
}
|
||||
ClassBuilder& ClassBuilder::defineSingletonMethod(const char* name, VALUE (*impl)(VALUE)) {
|
||||
rb_define_singleton_method(this->value, name, (VALUE (*)(...))impl, 0);
|
||||
return *this;
|
||||
|
|
|
@ -161,6 +161,7 @@ public:
|
|||
static VALUE Has(VALUE self, VALUE key);
|
||||
static VALUE Delete(VALUE self, VALUE key);
|
||||
static VALUE ForceDelete(VALUE self, VALUE key);
|
||||
static VALUE SetAccessor(int argc, VALUE* argv, VALUE self);
|
||||
|
||||
inline Object(VALUE value) : Ref<v8::Object>(value) {}
|
||||
};
|
||||
|
@ -175,9 +176,11 @@ class ClassBuilder {
|
|||
public:
|
||||
ClassBuilder(const char* name, VALUE superclass = rb_cObject);
|
||||
ClassBuilder(const char* name, const char* supername);
|
||||
ClassBuilder& defineMethod(const char* name, VALUE (*impl)(int, VALUE*, VALUE));
|
||||
ClassBuilder& defineMethod(const char* name, VALUE (*impl)(VALUE));
|
||||
ClassBuilder& defineMethod(const char* name, VALUE (*impl)(VALUE, VALUE));
|
||||
ClassBuilder& defineMethod(const char* name, VALUE (*impl)(VALUE, VALUE, VALUE));
|
||||
ClassBuilder& defineSingletonMethod(const char* name, VALUE (*impl)(int, VALUE*, VALUE));
|
||||
ClassBuilder& defineSingletonMethod(const char* name, VALUE (*impl)(VALUE));
|
||||
ClassBuilder& defineSingletonMethod(const char* name, VALUE (*impl)(VALUE, VALUE));
|
||||
ClassBuilder& defineSingletonMethod(const char* name, VALUE (*impl)(VALUE, VALUE, VALUE));
|
||||
|
|
Loading…
Add table
Reference in a new issue