diff options
author | Sam Roberts <vieuxtech@gmail.com> | 2019-04-09 15:21:36 -0700 |
---|---|---|
committer | Sam Roberts <vieuxtech@gmail.com> | 2019-04-12 12:33:37 -0700 |
commit | 060d901f87b3d87314f8540eb02f315e2952f581 (patch) | |
tree | 53159171201703bb6d8a4e780c8624a5c6c8cbb5 /src/stream_pipe.cc | |
parent | 7b0d8673898e65a368108264c77bccaa3e004028 (diff) | |
download | android-node-v8-060d901f87b3d87314f8540eb02f315e2952f581.tar.gz android-node-v8-060d901f87b3d87314f8540eb02f315e2952f581.tar.bz2 android-node-v8-060d901f87b3d87314f8540eb02f315e2952f581.zip |
src: replace FromJust() with Check() when possible
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 <apapirovski@mac.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Diffstat (limited to 'src/stream_pipe.cc')
-rw-r--r-- | src/stream_pipe.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/stream_pipe.cc b/src/stream_pipe.cc index a57ce274fa..bacf8fe771 100644 --- a/src/stream_pipe.cc +++ b/src/stream_pipe.cc @@ -31,13 +31,13 @@ StreamPipe::StreamPipe(StreamBase* source, // if that applies to the given streams (for example, Http2Streams use // weak references). obj->Set(env()->context(), env()->source_string(), source->GetObject()) - .FromJust(); + .Check(); source->GetObject()->Set(env()->context(), env()->pipe_target_string(), obj) - .FromJust(); + .Check(); obj->Set(env()->context(), env()->sink_string(), sink->GetObject()) - .FromJust(); + .Check(); sink->GetObject()->Set(env()->context(), env()->pipe_source_string(), obj) - .FromJust(); + .Check(); } StreamPipe::~StreamPipe() { @@ -267,7 +267,7 @@ void InitializeStreamPipe(Local<Object> target, target ->Set(context, stream_pipe_string, pipe->GetFunction(context).ToLocalChecked()) - .FromJust(); + .Check(); } } // anonymous namespace |