From 7a3f7780dc9eed1391b389dec82849137ac9d5f5 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 15 Aug 2013 19:22:44 +0200 Subject: [PATCH] src: add MakeCallback() that takes an array index Internal helper function for dispatching by array index rather than named property. --- src/node.cc | 17 +++++++++++++++++ src/node_internals.h | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/src/node.cc b/src/node.cc index 7b1d843..1d2f905 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1087,6 +1087,23 @@ MakeCallback(const Handle object, } +// Internal only. +Handle +MakeCallback(const Handle object, + uint32_t index, + int argc, + Handle argv[]) { + HandleScope scope(node_isolate); + + Local callback = object->Get(index).As(); + assert(callback->IsFunction()); + + if (using_domains) + return scope.Close(MakeDomainCallback(object, callback, argc, argv)); + return scope.Close(MakeCallback(object, callback, argc, argv)); +} + + Handle MakeCallback(const Handle object, const Handle symbol, diff --git a/src/node_internals.h b/src/node_internals.h index 5e7e65c..ba110a5 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -76,6 +76,12 @@ inline v8::Local PersistentToLocal( v8::Isolate* isolate, const v8::Persistent& persistent); +v8::Handle MakeCallback( + const v8::Handle recv, + uint32_t index, + int argc, + v8::Handle* argv); + template v8::Handle MakeCallback( const v8::Persistent& recv, -- 2.7.4