Skip to content

Commit

Permalink
src: use InstantiateModule instead of deprecated
Browse files Browse the repository at this point in the history
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> context,
                     ^

This commit changes this function call to use InstantiateModule instead
which returns a Maybe<bool>.

PR-URL: #15423
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
  • Loading branch information
danbev authored and MylesBorins committed Oct 3, 2017
1 parent e8da556 commit 902feea
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/module_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -178,14 +179,14 @@ void ModuleWrap::Instantiate(const FunctionCallbackInfo<Value>& args) {

ModuleWrap* obj = Unwrap<ModuleWrap>(that);
Local<Module> mod = obj->module_.Get(iso);
bool ok = mod->Instantiate(ctx, ModuleWrap::ResolveCallback);
Maybe<bool> 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;
}
}
Expand Down

0 comments on commit 902feea

Please sign in to comment.