From 24dab1e8d7342d26aba9918a876536637b38b2ad Mon Sep 17 00:00:00 2001 From: Scott Kyle Date: Wed, 4 May 2016 02:14:50 -0700 Subject: [PATCH] Heed v8 warning in Node v6 from v8::Template::Set --- src/node/node_class.hpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/node/node_class.hpp b/src/node/node_class.hpp index 757e6228..ea95cf98 100644 --- a/src/node/node_class.hpp +++ b/src/node/node_class.hpp @@ -104,7 +104,7 @@ class ObjectWrap { using Internal = void; static v8::Local get_template() { - return v8::Local();; + return v8::Local(); } }; @@ -195,22 +195,21 @@ inline v8::Local ObjectWrap::create_template() template inline void ObjectWrap::setup_method(v8::Local tpl, const std::string &name, Nan::FunctionCallback callback) { v8::Local signature = Nan::New(tpl); - v8::Local t = Nan::New(callback, v8::Local(), signature); - v8::Local fn = Nan::GetFunction(t).ToLocalChecked(); + v8::Local fn_tpl = Nan::New(callback, v8::Local(), signature); v8::Local fn_name = Nan::New(name).ToLocalChecked(); // The reason we use this rather than Nan::SetPrototypeMethod is DontEnum. - tpl->PrototypeTemplate()->Set(fn_name, fn, v8::PropertyAttribute::DontEnum); - fn->SetName(fn_name); + tpl->PrototypeTemplate()->Set(fn_name, fn_tpl, v8::PropertyAttribute::DontEnum); + fn_tpl->SetClassName(fn_name); } template inline void ObjectWrap::setup_static_method(v8::Local tpl, const std::string &name, Nan::FunctionCallback callback) { - v8::Local fn = Nan::GetFunction(Nan::New(callback)).ToLocalChecked(); + v8::Local fn_tpl = Nan::New(callback); v8::Local fn_name = Nan::New(name).ToLocalChecked(); - tpl->Set(fn_name, fn, v8::PropertyAttribute::DontEnum); - fn->SetName(fn_name); + tpl->Set(fn_name, fn_tpl, v8::PropertyAttribute::DontEnum); + fn_tpl->SetClassName(fn_name); } template