mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
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>
This commit is contained in:
1 parent
49f549e064
commit
979ec425bd
1 file changed
+2
-2
@@ -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
|
||||
|
||||
Reference in new issue
Block a user