diff options
author | Daniel Bevenius <daniel.bevenius@gmail.com> | 2020-05-08 16:20:03 +0300 |
---|---|---|
committer | Daniel Bevenius <daniel.bevenius@gmail.com> | 2020-05-12 06:44:53 +0300 |
commit | 8c5d58b5a765981a5309bf4218ed16b7332a5c45 (patch) | |
tree | 39fa139b72f8d4be110b54853f717e013120f9cb /src/node.cc | |
parent | 12b3e0c1acb937d919fe03f27499a9775ef05bbf (diff) |
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>
Diffstat (limited to 'src/node.cc')
-rw-r--r-- | src/node.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/node.cc b/src/node.cc index 240f1f2e3b0..5a10addcef8 100644 --- a/src/node.cc +++ b/src/node.cc @@ -171,11 +171,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(), |