From 103479a0c5ca6202e64b75adfbd47713cb023092 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 25 May 2020 14:15:43 +0200 Subject: [PATCH] src: use MaybeLocal.ToLocal instead of IsEmpty 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/33554 Reviewed-By: Zeyu Yang Reviewed-By: Colin Ihrig Reviewed-By: David Carlier Reviewed-By: James M Snell --- src/api/environment.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/environment.cc b/src/api/environment.cc index 9645b84c9eba41..60cc016b7702a9 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -498,10 +498,10 @@ bool InitializePrimordials(Local context) { MaybeLocal maybe_fn = native_module::NativeModuleEnv::LookupAndCompile( context, *module, ¶meters, nullptr); - if (maybe_fn.IsEmpty()) { + Local fn; + if (!maybe_fn.ToLocal(&fn)) { return false; } - Local fn = maybe_fn.ToLocalChecked(); MaybeLocal result = fn->Call(context, Undefined(isolate), arraysize(arguments), arguments); // Execution failed during context creation.