From 060d901f87b3d87314f8540eb02f315e2952f581 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Tue, 9 Apr 2019 15:21:36 -0700 Subject: src: replace FromJust() with Check() when possible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FromJust() is often used not for its return value, but for its side-effects. In these cases, Check() exists, and is more clear as to the intent. From its comment: To be used, where the actual value of the Maybe is not needed, like Object::Set. See: https://github.com/nodejs/node/pull/26929/files#r269256335 PR-URL: https://github.com/nodejs/node/pull/27162 Reviewed-By: Anatoli Papirovski Reviewed-By: Michaƫl Zasso Reviewed-By: Ben Noordhuis Reviewed-By: Gus Caplan Reviewed-By: Yongsheng Zhang --- src/async_wrap.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/async_wrap.cc') diff --git a/src/async_wrap.cc b/src/async_wrap.cc index 0cee1b2db1..dd84f99227 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -487,11 +487,11 @@ void AsyncWrap::Initialize(Local target, target->Set(context, env->async_ids_stack_string(), - env->async_hooks()->async_ids_stack().GetJSArray()).FromJust(); + env->async_hooks()->async_ids_stack().GetJSArray()).Check(); target->Set(context, FIXED_ONE_BYTE_STRING(env->isolate(), "owner_symbol"), - env->owner_symbol()).FromJust(); + env->owner_symbol()).Check(); Local constants = Object::New(isolate); #define SET_HOOKS_CONSTANT(name) \ @@ -542,7 +542,7 @@ void AsyncWrap::Initialize(Local target, instance_template->SetInternalFieldCount(1); auto function = function_template->GetFunction(env->context()).ToLocalChecked(); - target->Set(env->context(), class_name, function).FromJust(); + target->Set(env->context(), class_name, function).Check(); env->set_async_wrap_object_ctor_template(function_template); } } -- cgit v1.2.3