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: nodejs#14053
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
Reviewed-By: Franziska Hinkelmann <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
  • Loading branch information
bnoordhuis authored and Gabriel Schulhof committed Apr 10, 2018
1 parent 22b9a87 commit c95b561
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 @@ -2020,8 +2020,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 c95b561

Please sign in to comment.