Skip to content

Commit

Permalink
Don't use deprecated v8::Template::Set(). (#560)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
amitparida committed Apr 27, 2016
1 parent ad4c5c3 commit bce3540
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nan.h
Original file line number Diff line number Diff line change
Expand Up @@ -1867,13 +1867,13 @@ NAN_INLINE void SetPrototypeMethod(
v8::Local<v8::FunctionTemplate> recv
, const char* name, FunctionCallback callback) {
HandleScope scope;
v8::Local<v8::Function> fn = GetFunction(New<v8::FunctionTemplate>(
v8::Local<v8::FunctionTemplate> t = New<v8::FunctionTemplate>(
callback
, v8::Local<v8::Value>()
, New<v8::Signature>(recv))).ToLocalChecked();
, New<v8::Signature>(recv));
v8::Local<v8::String> 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 =======================================================
Expand Down

0 comments on commit bce3540

Please sign in to comment.