Browse Source

n-api: use Maybe version of Object::SetPrototype()

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: https://github.com/nodejs/node/pull/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>
v6
Ben Noordhuis 8 years ago
parent
commit
c9b6d95161
  1. 4
      src/node_api.cc

4
src/node_api.cc

@ -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()

Loading…
Cancel
Save