Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Bevenius <daniel.bevenius@gmail.com>2020-05-18 14:18:52 +0300
committerDaniel Bevenius <daniel.bevenius@gmail.com>2020-05-22 06:37:48 +0300
commit979ec425bd62df70e8e1409917f4ebf711fe104b (patch)
treea40e3783c4bf7ed964cdfb35f9a968b15a94b64d /src/node_native_module.cc
parent49f549e064e92c1db0392994d8a4636726d38a75 (diff)
src: use MaybeLocal.ToLocal instead of IsEmpty
This commit suggest using MaybeLocal.ToLocal and passing in the Local<Function> fun. The motivation for doing this is that the following MaybeLocal.ToLocalChecked call can then be avoided. PR-URL: https://github.com/nodejs/node/pull/33457 Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Diffstat (limited to 'src/node_native_module.cc')
-rw-r--r--src/node_native_module.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/node_native_module.cc b/src/node_native_module.cc
index c3a77198090..a57355418be 100644
--- a/src/node_native_module.cc
+++ b/src/node_native_module.cc
@@ -292,14 +292,14 @@ MaybeLocal<Function> NativeModuleLoader::LookupAndCompile(
// This could fail when there are early errors in the native modules,
// e.g. the syntax errors
- if (maybe_fun.IsEmpty()) {
+ Local<Function> fun;
+ if (!maybe_fun.ToLocal(&fun)) {
// In the case of early errors, v8 is already capable of
// decorating the stack for us - note that we use CompileFunctionInContext
// so there is no need to worry about wrappers.
return MaybeLocal<Function>();
}
- Local<Function> fun = maybe_fun.ToLocalChecked();
// XXX(joyeecheung): this bookkeeping is not exactly accurate because
// it only starts after the Environment is created, so the per_context.js
// will never be in any of these two sets, but the two sets are only for