From 70fd2486c5d278f331e556a556ab6379d1b066fd Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 26 Apr 2016 23:05:58 +0200 Subject: [PATCH] Don't use deprecated v8::Template::Set(). See [0] and [1]: starting with node.js v6, setting non-primitive values on FunctionTemplate and ObjectTemplate instances is discouraged; v7 will downright disallow it. Update `Nan::SetPrototypeMethod()`. [0] https://github.com/nodejs/node/issues/6216 [1] https://github.com/nodejs/node/pull/6228 --- nan.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nan.h b/nan.h index b50a7218..2ad98d2c 100644 --- a/nan.h +++ b/nan.h @@ -1867,13 +1867,13 @@ NAN_INLINE void SetPrototypeMethod( v8::Local recv , const char* name, FunctionCallback callback) { HandleScope scope; - v8::Local fn = GetFunction(New( + v8::Local t = New( callback , v8::Local() - , New(recv))).ToLocalChecked(); + , New(recv)); v8::Local fn_name = New(name).ToLocalChecked(); - recv->PrototypeTemplate()->Set(fn_name, fn); - fn->SetName(fn_name); + recv->PrototypeTemplate()->Set(fn_name, t); + t->SetClassName(fn_name); } //=== Accessors and Such =======================================================