1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00

Use equivalence classe for integer conversion

This commit is contained in:
Charles Lowell 2012-05-22 12:17:31 -05:00
parent 7f659ef385
commit 08c458174c
6 changed files with 8 additions and 8 deletions

View file

@ -16,7 +16,7 @@ VALUE Array::New(int argc, VALUE argv[], VALUE self) {
}
VALUE Array::Length(VALUE self) {
return UINT2NUM(Array(self)->Length());
return UInt32(Array(self)->Length());
}
VALUE Array::CloneElementAt(VALUE self, VALUE index) {

View file

@ -43,11 +43,11 @@ namespace rr {
}
VALUE Function::GetScriptLineNumber(VALUE self) {
return INT2FIX(Function(self)->GetScriptLineNumber());
return Int(Function(self)->GetScriptLineNumber());
}
VALUE Function::GetScriptColumnNumber(VALUE self) {
return INT2FIX(Function(self)->GetScriptColumnNumber());
return Int(Function(self)->GetScriptColumnNumber());
}
VALUE Function::GetScriptId(VALUE self) {

View file

@ -57,7 +57,7 @@ namespace rr {
}
VALUE Invocation::Arguments::Length(VALUE self) {
return INT2FIX(Arguments(self)->Length());
return Int(Arguments(self)->Length());
}
VALUE Invocation::Arguments::Get(VALUE self, VALUE index) {

View file

@ -68,7 +68,7 @@ namespace rr {
return *this;
}
ClassBuilder& ClassBuilder::defineEnumConst(const char* name, int value) {
rb_define_const(this->value, name, INT2FIX(value));
rb_define_const(this->value, name, Int(value));
return *this;
}
ClassBuilder& ClassBuilder::store(VALUE* storage) {

View file

@ -94,7 +94,7 @@ namespace rr {
}
VALUE ObjectTemplate::InternalFieldCount(VALUE self) {
return INT2FIX(ObjectTemplate(self)->InternalFieldCount());
return Int(ObjectTemplate(self)->InternalFieldCount());
}
VALUE ObjectTemplate::SetInternalFieldCount(VALUE self, VALUE count) {

View file

@ -31,10 +31,10 @@ Value::operator VALUE() {
return External((v8::Handle<v8::External>)v8::External::Cast(*handle));
}
if (handle->IsUint32()) {
return UINT2NUM(handle->Uint32Value());
return UInt32(handle->Uint32Value());
}
if (handle->IsInt32()) {
return INT2FIX(handle->Int32Value());
return Int(handle->Int32Value());
}
if (handle->IsBoolean()) {
return handle->BooleanValue() ? Qtrue : Qfalse;