Skip to content

Commit

Permalink
n-api: use Maybe version of Object::SetPrototype()
Browse files Browse the repository at this point in the history
Fixes the following deprecation warning:

    ../src/node_api.cc:2020:30: warning: 'bool
    v8::Object::SetPrototype(v8::Local<v8::Value>)' is deprecated: Use
    maybe version [-Wdeprecated-declarations]
       wrapper->SetPrototype(proto);
    ../src/node_api.cc:2021:28: warning: 'bool
    v8::Object::SetPrototype(v8::Local<v8::Value>)' is deprecated: Use
    maybe version [-Wdeprecated-declarations]
       obj->SetPrototype(wrapper);

PR-URL: #14053
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
  • Loading branch information
bnoordhuis committed Jul 5, 2017
1 parent 0fd4c73 commit c9b6d95
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/node_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2017,8 +2017,8 @@ napi_status napi_wrap(napi_env env,

// Insert the wrapper into the object's prototype chain.
v8::Local<v8::Value> proto = obj->GetPrototype();
wrapper->SetPrototype(proto);
obj->SetPrototype(wrapper);
CHECK(wrapper->SetPrototype(context, proto).FromJust());
CHECK(obj->SetPrototype(context, wrapper).FromJust());

if (result != nullptr) {
// The returned reference should be deleted via napi_delete_reference()
Expand Down

0 comments on commit c9b6d95

Please sign in to comment.