Skip to content

Commit 6cf58d4

Browse files
danbevcodebytere
authored andcommitted
src: use MaybeLocal.ToLocal instead of IsEmpty
This commit suggest using MaybeLocal.ToLocal and passing in the Local<Function> fn. The motivation for doing this is that the following MaybeLocal.ToLocalChecked call can then be avoided. PR-URL: #33554 Reviewed-By: Zeyu Yang <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 609d395 commit 6cf58d4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/api/environment.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -634,10 +634,10 @@ bool InitializePrimordials(Local<Context> context) {
634634
MaybeLocal<Function> maybe_fn =
635635
native_module::NativeModuleEnv::LookupAndCompile(
636636
context, *module, &parameters, nullptr);
637-
if (maybe_fn.IsEmpty()) {
637+
Local<Function> fn;
638+
if (!maybe_fn.ToLocal(&fn)) {
638639
return false;
639640
}
640-
Local<Function> fn = maybe_fn.ToLocalChecked();
641641
MaybeLocal<Value> result =
642642
fn->Call(context, Undefined(isolate), arraysize(arguments), arguments);
643643
// Execution failed during context creation.

0 commit comments

Comments
 (0)