From 0718426506275fdaf97b2f8688e68dbbb3964c23 Mon Sep 17 00:00:00 2001 From: Trevor Norris Date: Mon, 11 Aug 2014 17:10:43 -0700 Subject: [PATCH] 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 --- src/node.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/node.h b/src/node.h index 8937706..4eaaa07 100644 --- a/src/node.h +++ b/src/node.h @@ -232,8 +232,10 @@ inline void NODE_SET_PROTOTYPE_METHOD(v8::Handle recv, v8::Handle s = v8::Signature::New(isolate, recv); v8::Local t = v8::FunctionTemplate::New(isolate, callback, v8::Handle(), s); - recv->PrototypeTemplate()->Set(v8::String::NewFromUtf8(isolate, name), - t->GetFunction()); + v8::Local fn = t->GetFunction(); + recv->PrototypeTemplate()->Set(v8::String::NewFromUtf8(isolate, name), fn); + v8::Local fn_name = v8::String::NewFromUtf8(isolate, name); + fn->SetName(fn_name); } #define NODE_SET_PROTOTYPE_METHOD node::NODE_SET_PROTOTYPE_METHOD -- 2.7.4