From 066ca980696d0301ea2b6cdf502b16c51d329d83 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 240f1f2e3b00f3..5a10addcef8615 100644 --- a/src/node.cc +++ b/src/node.cc @@ -171,11 +171,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(),