From 548672d39ccf9a4f31fedfbfc463dff1bd4587cc Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Fri, 8 May 2020 15:20:03 +0200 Subject: [PATCH] src: use MaybeLocal.ToLocal instead of IsEmpty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit suggest using MaybeLocal.ToLocal and passing in the Local 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 Reviewed-By: Franziska Hinkelmann Reviewed-By: Anna Henningsen Reviewed-By: David Carlier Reviewed-By: Juan José Arboleda Reviewed-By: James M Snell --- src/node.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node.cc b/src/node.cc index da6aebf7178cf6..90b04df7e5cd88 100644 --- a/src/node.cc +++ b/src/node.cc @@ -165,11 +165,11 @@ MaybeLocal ExecuteBootstrapper(Environment* env, MaybeLocal maybe_fn = NativeModuleEnv::LookupAndCompile(env->context(), id, parameters, env); - if (maybe_fn.IsEmpty()) { + Local fn; + if (!maybe_fn.ToLocal(&fn)) { return MaybeLocal(); } - Local fn = maybe_fn.ToLocalChecked(); MaybeLocal result = fn->Call(env->context(), Undefined(env->isolate()), arguments->size(),