Skip to content

Commit ee45b78

Browse files
danbevcodebytere
authored andcommitted
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: #33457 Reviewed-By: Zeyu Yang <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]>
1 parent b675ea0 commit ee45b78

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/node_native_module.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -292,14 +292,14 @@ MaybeLocal<Function> NativeModuleLoader::LookupAndCompile(
292292

293293
// This could fail when there are early errors in the native modules,
294294
// e.g. the syntax errors
295-
if (maybe_fun.IsEmpty()) {
295+
Local<Function> fun;
296+
if (!maybe_fun.ToLocal(&fun)) {
296297
// In the case of early errors, v8 is already capable of
297298
// decorating the stack for us - note that we use CompileFunctionInContext
298299
// so there is no need to worry about wrappers.
299300
return MaybeLocal<Function>();
300301
}
301302

302-
Local<Function> fun = maybe_fun.ToLocalChecked();
303303
// XXX(joyeecheung): this bookkeeping is not exactly accurate because
304304
// it only starts after the Environment is created, so the per_context.js
305305
// will never be in any of these two sets, but the two sets are only for

0 commit comments

Comments
 (0)