mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
1 parent
318fcf8188
commit
548672d39c
1 file changed
+2
-2
+2
-2
@@ -165,11 +165,11 @@ MaybeLocal<Value> ExecuteBootstrapper(Environment* env,
|
||||
MaybeLocal<Function> maybe_fn =
|
||||
NativeModuleEnv::LookupAndCompile(env->context(), id, parameters, env);
|
||||
|
||||
if (maybe_fn.IsEmpty()) {
|
||||
Local<Function> fn;
|
||||
if (!maybe_fn.ToLocal(&fn)) {
|
||||
return MaybeLocal<Value>();
|
||||
}
|
||||
|
||||
Local<Function> fn = maybe_fn.ToLocalChecked();
|
||||
MaybeLocal<Value> result = fn->Call(env->context(),
|
||||
Undefined(env->isolate()),
|
||||
arguments->size(),
|
||||
|
||||
Reference in new issue
Block a user