Skip to content

Commit

Permalink
node: set names for prototype methods
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
trevnorris committed Aug 12, 2014
1 parent 42bda05 commit 0718426
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0718426

Please sign in to comment.