diff options
author | Sam Roberts <vieuxtech@gmail.com> | 2019-04-10 01:21:36 +0300 |
---|---|---|
committer | Sam Roberts <vieuxtech@gmail.com> | 2019-04-12 22:33:37 +0300 |
commit | 060d901f87b3d87314f8540eb02f315e2952f581 (patch) | |
tree | 53159171201703bb6d8a4e780c8624a5c6c8cbb5 /src/node_serdes.cc | |
parent | 7b0d8673898e65a368108264c77bccaa3e004028 (diff) |
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_serdes.cc')
-rw-r--r-- | src/node_serdes.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/node_serdes.cc b/src/node_serdes.cc index 12ed313b033..682f90f0c3d 100644 --- a/src/node_serdes.cc +++ b/src/node_serdes.cc @@ -284,7 +284,7 @@ DeserializerContext::DeserializerContext(Environment* env, data_(reinterpret_cast<const uint8_t*>(Buffer::Data(buffer))), length_(Buffer::Length(buffer)), deserializer_(env->isolate(), data_, length_, this) { - object()->Set(env->context(), env->buffer_string(), buffer).FromJust(); + object()->Set(env->context(), env->buffer_string(), buffer).Check(); deserializer_.SetExpectInlineWasm(true); MakeWeak(); @@ -471,7 +471,7 @@ void Initialize(Local<Object> target, ser->SetClassName(serializerString); target->Set(env->context(), serializerString, - ser->GetFunction(env->context()).ToLocalChecked()).FromJust(); + ser->GetFunction(env->context()).ToLocalChecked()).Check(); Local<FunctionTemplate> des = env->NewFunctionTemplate(DeserializerContext::New); @@ -496,7 +496,7 @@ void Initialize(Local<Object> target, des->SetClassName(deserializerString); target->Set(env->context(), deserializerString, - des->GetFunction(env->context()).ToLocalChecked()).FromJust(); + des->GetFunction(env->context()).ToLocalChecked()).Check(); } } // anonymous namespace |