From 695590e386845bc11bb42aa7f26327f2fba6d2a5 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Fri, 9 Mar 2018 08:29:27 +0100 Subject: [PATCH] test: fix compiler warnings in callback-scope MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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)); ^ ../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 New(Isolate* isolate)); This commit updates the test to use non-deprecated functions. PR-URL: https://github.com/nodejs/node/pull/19252 Reviewed-By: Michaƫl Zasso Reviewed-By: Franziska Hinkelmann Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Michael Dawson Reviewed-By: Joyee Cheung --- test/addons/callback-scope/binding.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/addons/callback-scope/binding.cc b/test/addons/callback-scope/binding.cc index 3b69d2d5725a8f..94d5ec91d7f3a2 100644 --- a/test/addons/callback-scope/binding.cc +++ b/test/addons/callback-scope/binding.cc @@ -41,7 +41,8 @@ static void Callback(uv_work_t* req, int ignored) { v8::Local local = v8::Local::New(isolate, persistent); - local->Resolve(v8::Undefined(isolate)); + local->Resolve(isolate->GetCurrentContext(), + v8::Undefined(isolate)).ToChecked(); delete req; } @@ -49,7 +50,8 @@ static void TestResolveAsync(const v8::FunctionCallbackInfo& 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;