Skip to content

Commit 548672d

Browse files
danbevcodebytere
authored andcommittedJun 7, 2020
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 <cjihrig@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 318fcf8 commit 548672d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎src/node.cc

+2-2
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)