Browse Source

src: add MakeCallback() that takes an array index

Internal helper function for dispatching by array index rather than
named property.
v0.11.6-release
Ben Noordhuis 12 years ago
parent
commit
7a3f7780dc
  1. 17
      src/node.cc
  2. 6
      src/node_internals.h

17
src/node.cc

@ -1087,6 +1087,23 @@ MakeCallback(const Handle<Object> object,
}
// Internal only.
Handle<Value>
MakeCallback(const Handle<Object> object,
uint32_t index,
int argc,
Handle<Value> argv[]) {
HandleScope scope(node_isolate);
Local<Function> callback = object->Get(index).As<Function>();
assert(callback->IsFunction());
if (using_domains)
return scope.Close(MakeDomainCallback(object, callback, argc, argv));
return scope.Close(MakeCallback(object, callback, argc, argv));
}
Handle<Value>
MakeCallback(const Handle<Object> object,
const Handle<String> symbol,

6
src/node_internals.h

@ -76,6 +76,12 @@ inline v8::Local<TypeName> PersistentToLocal(
v8::Isolate* isolate,
const v8::Persistent<TypeName>& persistent);
v8::Handle<v8::Value> MakeCallback(
const v8::Handle<v8::Object> recv,
uint32_t index,
int argc,
v8::Handle<v8::Value>* argv);
template <typename TypeName>
v8::Handle<v8::Value> MakeCallback(
const v8::Persistent<v8::Object>& recv,

Loading…
Cancel
Save