From 20d54f6908394bedde26dd65dcd567432394fd01 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 99b185798a7f9e..5349657d4c5a8d 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -634,10 +634,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.