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/node_http2.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/node_http2.cc')
-rw-r--r-- | src/node_http2.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/node_http2.cc b/src/node_http2.cc index b2666f1c8b..17c87cd727 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -2530,7 +2530,7 @@ void Http2Session::UpdateChunksSent(const FunctionCallbackInfo<Value>& args) { session->object()->Set(env->context(), env->chunks_sent_since_last_write_string(), - Integer::NewFromUnsigned(isolate, length)).FromJust(); + Integer::NewFromUnsigned(isolate, length)).Check(); args.GetReturnValue().Set(length); } @@ -3015,7 +3015,7 @@ void Initialize(Local<Object> target, env->set_http2stream_constructor_template(streamt); target->Set(context, FIXED_ONE_BYTE_STRING(env->isolate(), "Http2Stream"), - stream->GetFunction(env->context()).ToLocalChecked()).FromJust(); + stream->GetFunction(env->context()).ToLocalChecked()).Check(); Local<FunctionTemplate> session = env->NewFunctionTemplate(Http2Session::New); @@ -3043,7 +3043,7 @@ void Initialize(Local<Object> target, Http2Session::RefreshSettings<nghttp2_session_get_remote_settings>); target->Set(context, http2SessionClassName, - session->GetFunction(env->context()).ToLocalChecked()).FromJust(); + session->GetFunction(env->context()).ToLocalChecked()).Check(); Local<Object> constants = Object::New(isolate); Local<Array> name_for_error_code = Array::New(isolate); @@ -3078,7 +3078,7 @@ void Initialize(Local<Object> target, name_for_error_code->Set(env->context(), \ static_cast<int>(name), \ FIXED_ONE_BYTE_STRING(isolate, \ - #name)).FromJust(); + #name)).Check(); NODE_NGHTTP2_ERROR_CODES(V) #undef V @@ -3146,10 +3146,10 @@ HTTP_STATUS_CODES(V) target->Set(context, env->constants_string(), - constants).FromJust(); + constants).Check(); target->Set(context, FIXED_ONE_BYTE_STRING(isolate, "nameForErrorCode"), - name_for_error_code).FromJust(); + name_for_error_code).Check(); } } // namespace http2 } // namespace node |