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_v8.cc | |
parent | 7b0d8673898e65a368108264c77bccaa3e004028 (diff) | |
download | node-new-060d901f87b3d87314f8540eb02f315e2952f581.tar.gz |
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_v8.cc')
-rw-r--r-- | src/node_v8.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/node_v8.cc b/src/node_v8.cc index 8ed0e41670..5adc53b84d 100644 --- a/src/node_v8.cc +++ b/src/node_v8.cc @@ -139,12 +139,12 @@ void Initialize(Local<Object> target, "heapStatisticsArrayBuffer"), ArrayBuffer::New(env->isolate(), env->heap_statistics_buffer(), - heap_statistics_buffer_byte_length)).FromJust(); + heap_statistics_buffer_byte_length)).Check(); #define V(i, _, name) \ target->Set(env->context(), \ FIXED_ONE_BYTE_STRING(env->isolate(), #name), \ - Uint32::NewFromUnsigned(env->isolate(), i)).FromJust(); + Uint32::NewFromUnsigned(env->isolate(), i)).Check(); HEAP_STATISTICS_PROPERTIES(V) #undef V @@ -154,7 +154,7 @@ void Initialize(Local<Object> target, "kHeapSpaceStatisticsPropertiesCount"), Uint32::NewFromUnsigned(env->isolate(), kHeapSpaceStatisticsPropertiesCount)) - .FromJust(); + .Check(); size_t number_of_heap_spaces = env->isolate()->NumberOfHeapSpaces(); @@ -169,11 +169,11 @@ void Initialize(Local<Object> target, s.space_name(), NewStringType::kNormal) .ToLocalChecked(); - heap_spaces->Set(env->context(), i, heap_space_name).FromJust(); + heap_spaces->Set(env->context(), i, heap_space_name).Check(); } target->Set(env->context(), FIXED_ONE_BYTE_STRING(env->isolate(), "kHeapSpaces"), - heap_spaces).FromJust(); + heap_spaces).Check(); env->SetMethod(target, "updateHeapSpaceStatisticsArrayBuffer", @@ -193,12 +193,12 @@ void Initialize(Local<Object> target, ArrayBuffer::New(env->isolate(), env->heap_space_statistics_buffer(), heap_space_statistics_buffer_byte_length)) - .FromJust(); + .Check(); #define V(i, _, name) \ target->Set(env->context(), \ FIXED_ONE_BYTE_STRING(env->isolate(), #name), \ - Uint32::NewFromUnsigned(env->isolate(), i)).FromJust(); + Uint32::NewFromUnsigned(env->isolate(), i)).Check(); HEAP_SPACE_STATISTICS_PROPERTIES(V) #undef V |