diff options
author | Trevor Norris <trev.norris@gmail.com> | 2014-08-11 17:10:43 -0700 |
---|---|---|
committer | Trevor Norris <trev.norris@gmail.com> | 2014-08-11 17:10:43 -0700 |
commit | 0718426506275fdaf97b2f8688e68dbbb3964c23 (patch) | |
tree | 1efd1d8ab27b70dbc48268fae2f6846ec5c3b35b /src/node.h | |
parent | 42bda05af8d628db90f3ee64fa2dd89973cb1e03 (diff) | |
download | android-node-v8-0718426506275fdaf97b2f8688e68dbbb3964c23.tar.gz android-node-v8-0718426506275fdaf97b2f8688e68dbbb3964c23.tar.bz2 android-node-v8-0718426506275fdaf97b2f8688e68dbbb3964c23.zip |
node: set names for prototype methods
Fix issue where output of a native prototype method would simply print
[Function]. It will now print [Function: name].
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'src/node.h')
-rw-r--r-- | src/node.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/node.h b/src/node.h index 8937706d9d..4eaaa07859 100644 --- a/src/node.h +++ b/src/node.h @@ -232,8 +232,10 @@ inline void NODE_SET_PROTOTYPE_METHOD(v8::Handle<v8::FunctionTemplate> recv, v8::Handle<v8::Signature> s = v8::Signature::New(isolate, recv); v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate, callback, v8::Handle<v8::Value>(), s); - recv->PrototypeTemplate()->Set(v8::String::NewFromUtf8(isolate, name), - t->GetFunction()); + v8::Local<v8::Function> fn = t->GetFunction(); + recv->PrototypeTemplate()->Set(v8::String::NewFromUtf8(isolate, name), fn); + v8::Local<v8::String> fn_name = v8::String::NewFromUtf8(isolate, name); + fn->SetName(fn_name); } #define NODE_SET_PROTOTYPE_METHOD node::NODE_SET_PROTOTYPE_METHOD |