Skip to content

Commit 548672d

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: #33312 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 318fcf8 commit 548672d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/node.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ MaybeLocal<Value> ExecuteBootstrapper(Environment* env,
165165
MaybeLocal<Function> maybe_fn =
166166
NativeModuleEnv::LookupAndCompile(env->context(), id, parameters, env);
167167

168-
if (maybe_fn.IsEmpty()) {
168+
Local<Function> fn;
169+
if (!maybe_fn.ToLocal(&fn)) {
169170
return MaybeLocal<Value>();
170171
}
171172

172-
Local<Function> fn = maybe_fn.ToLocalChecked();
173173
MaybeLocal<Value> result = fn->Call(env->context(),
174174
Undefined(env->isolate()),
175175
arguments->size(),

0 commit comments

Comments
 (0)