Skip to content

Commit

Permalink
test: fix compiler warnings in callback-scope
Browse files Browse the repository at this point in the history
Currently there are two compiler warnings generated from the addons test
callback-scope:

../binding.cc:44:10:
warning: 'Resolve' is deprecated [-Wdeprecated-declarations]
  local->Resolve(v8::Undefined(isolate));
         ^
../../../../deps/v8/include/v8.h:3893:45:
note: 'Resolve' has been explicitly marked deprecated here
V8_DEPRECATED("Use maybe version", void Resolve(Local<Value> value));
         ^

../binding.cc:52:54:
warning: 'New' is deprecated [-Wdeprecated-declarations]
    persistent.Reset(isolate, v8::Promise::Resolver::New(isolate));
                                                     ^
../../../../deps/v8/include/v8.h:3880:42:
note: 'New' has been explicitly marked deprecated here
Local<Resolver> New(Isolate* isolate));

This commit updates the test to use non-deprecated functions.

PR-URL: #19252
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
  • Loading branch information
danbev authored and MylesBorins committed Mar 20, 2018
1 parent d3bc72e commit b8ca616
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/addons/callback-scope/binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ static void Callback(uv_work_t* req, int ignored) {

v8::Local<v8::Promise::Resolver> local =
v8::Local<v8::Promise::Resolver>::New(isolate, persistent);
local->Resolve(v8::Undefined(isolate));
local->Resolve(isolate->GetCurrentContext(),
v8::Undefined(isolate)).ToChecked();
delete req;
}

static void TestResolveAsync(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Isolate* isolate = args.GetIsolate();

if (persistent.IsEmpty()) {
persistent.Reset(isolate, v8::Promise::Resolver::New(isolate));
persistent.Reset(isolate, v8::Promise::Resolver::New(
isolate->GetCurrentContext()).ToLocalChecked());

uv_work_t* req = new uv_work_t;

Expand Down

0 comments on commit b8ca616

Please sign in to comment.