Skip to content

Commit 00dacf0

Browse files
bnoordhuiskkoopa
authored andcommitted
Don't use deprecated v8::Template::Set(). (#560)
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] nodejs/node#6216 [1] nodejs/node#6228
1 parent bc7986a commit 00dacf0

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

nan.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,13 +1867,13 @@ NAN_INLINE void SetPrototypeMethod(
18671867
v8::Local<v8::FunctionTemplate> recv
18681868
, const char* name, FunctionCallback callback) {
18691869
HandleScope scope;
1870-
v8::Local<v8::Function> fn = GetFunction(New<v8::FunctionTemplate>(
1870+
v8::Local<v8::FunctionTemplate> t = New<v8::FunctionTemplate>(
18711871
callback
18721872
, v8::Local<v8::Value>()
1873-
, New<v8::Signature>(recv))).ToLocalChecked();
1873+
, New<v8::Signature>(recv));
18741874
v8::Local<v8::String> fn_name = New(name).ToLocalChecked();
1875-
recv->PrototypeTemplate()->Set(fn_name, fn);
1876-
fn->SetName(fn_name);
1875+
recv->PrototypeTemplate()->Set(fn_name, t);
1876+
t->SetClassName(fn_name);
18771877
}
18781878

18791879
//=== Accessors and Such =======================================================

0 commit comments

Comments
 (0)