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/pipe_wrap.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/pipe_wrap.cc') diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index cafa33f9af..26ccfd8a47 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -90,7 +90,7 @@ void PipeWrap::Initialize(Local target, target->Set(env->context(), pipeString, - t->GetFunction(env->context()).ToLocalChecked()).FromJust(); + t->GetFunction(env->context()).ToLocalChecked()).Check(); env->set_pipe_constructor_template(t); // Create FunctionTemplate for PipeConnectWrap. @@ -101,7 +101,7 @@ void PipeWrap::Initialize(Local target, cwt->SetClassName(wrapString); target->Set(env->context(), wrapString, - cwt->GetFunction(env->context()).ToLocalChecked()).FromJust(); + cwt->GetFunction(env->context()).ToLocalChecked()).Check(); // Define constants Local constants = Object::New(env->isolate()); @@ -112,7 +112,7 @@ void PipeWrap::Initialize(Local target, NODE_DEFINE_CONSTANT(constants, UV_WRITABLE); target->Set(context, env->constants_string(), - constants).FromJust(); + constants).Check(); } -- cgit v1.2.3