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

wrap calling from v8 -> rb so that we get uniform stack treatment

This commit is contained in:
Charles Lowell 2010-05-27 18:30:19 +03:00
parent 87db724627
commit ab33a88411
3 changed files with 11 additions and 6 deletions

View file

@ -15,7 +15,7 @@ module V8
if method_name
method = obj.method(method_name)
if method.arity == 0
To.v8(method.call())
Function.rubycall(method)
else
To.v8(method)
end

View file

@ -14,5 +14,14 @@ module V8
raise err if err
return return_value
end
def self.rubycall(rubycode, *args)
begin
To.v8(rubycode.call(*args))
rescue StandardError => e
V8::C::ThrowException(V8::C::Exception::Error(V8::C::String::New(e.message)))
end
end
end
end

View file

@ -28,11 +28,7 @@ module V8
for i in 0..arguments.Length() - 1
rbargs << To.ruby(arguments[i])
end
begin
To.v8(value.call(*rbargs))
rescue StandardError => e
V8::C::ThrowException(V8::C::Exception::Error(V8::C::String::New(e.message)))
end
V8::Function.rubycall(value, *rbargs)
end
return template.GetFunction()
when ::Array