From cb0ef2530222b8c6e8e053e6685fb615b9ae8b70 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. --- 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.