Skip to content

Commit 902feea

Browse files
danbevMylesBorins
authored andcommitted
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>. 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>
1 parent e8da556 commit 902feea

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/module_wrap.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ using v8::IntegrityLevel;
2424
using v8::Isolate;
2525
using v8::JSON;
2626
using v8::Local;
27+
using v8::Maybe;
2728
using v8::MaybeLocal;
2829
using v8::Module;
2930
using v8::Object;
@@ -178,14 +179,14 @@ void ModuleWrap::Instantiate(const FunctionCallbackInfo<Value>& args) {
178179

179180
ModuleWrap* obj = Unwrap<ModuleWrap>(that);
180181
Local<Module> mod = obj->module_.Get(iso);
181-
bool ok = mod->Instantiate(ctx, ModuleWrap::ResolveCallback);
182+
Maybe<bool> ok = mod->InstantiateModule(ctx, ModuleWrap::ResolveCallback);
182183

183184
// clear resolve cache on instantiate
184185
for (auto& entry : obj->resolve_cache_)
185186
entry.second.Reset();
186187
obj->resolve_cache_.clear();
187188

188-
if (!ok) {
189+
if (!ok.FromMaybe(false)) {
189190
return;
190191
}
191192
}

0 commit comments

Comments
 (0)