Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
src: use InstantiateModule instead of deprecated
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>.
  • Loading branch information
danbev committed Sep 15, 2017
commit 3ebf0506a733886d3078f1d444e5a2b97a8de76b
5 changes: 3 additions & 2 deletions src/module_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,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 @@ -184,12 +185,12 @@ 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
obj->resolve_cache_.clear();

if (!ok) {
if (!ok.FromMaybe(false)) {
return;
}
}
Expand Down