From 902feeaad83395804f3c76ac9cb56b5ac9b888cc Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Fri, 15 Sep 2017 08:03:52 +0200 Subject: [PATCH] src: use InstantiateModule instead of deprecated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The following deprecation warning is displayed when compiling: ../src/module_wrap.cc:187:18: warning: 'Instantiate' is deprecated [-Wdeprecated-declarations] bool ok = mod->Instantiate(ctx, ModuleWrap::ResolveCallback); ^ ../deps/v8/include/v8.h:1158:22: note: 'Instantiate' has been explicitly marked deprecated here bool Instantiate(Local context, ^ This commit changes this function call to use InstantiateModule instead which returns a Maybe. PR-URL: https://github.com/nodejs/node/pull/15423 Reviewed-By: Michaƫl Zasso Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Franziska Hinkelmann --- src/module_wrap.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/module_wrap.cc b/src/module_wrap.cc index 99a0371df63893..a117ba24bf852f 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -24,6 +24,7 @@ using v8::IntegrityLevel; using v8::Isolate; using v8::JSON; using v8::Local; +using v8::Maybe; using v8::MaybeLocal; using v8::Module; using v8::Object; @@ -178,14 +179,14 @@ void ModuleWrap::Instantiate(const FunctionCallbackInfo& args) { ModuleWrap* obj = Unwrap(that); Local mod = obj->module_.Get(iso); - bool ok = mod->Instantiate(ctx, ModuleWrap::ResolveCallback); + Maybe ok = mod->InstantiateModule(ctx, ModuleWrap::ResolveCallback); // clear resolve cache on instantiate for (auto& entry : obj->resolve_cache_) entry.second.Reset(); obj->resolve_cache_.clear(); - if (!ok) { + if (!ok.FromMaybe(false)) { return; } }