Repository: nodejs/node
Pull request: src: use `Maybe<void>` where bool isn't needed


Changed files:
filename: src/cares_wrap.cc
patch: @@ -66,6 +66,7 @@ using v8::Int32;
 using v8::Integer;
 using v8::Isolate;
 using v8::Just;
+using v8::JustVoid;
 using v8::Local;
 using v8::Maybe;
 using v8::Nothing;
@@ -1450,7 +1451,7 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) {
   if (status == 0) {
     Local<Array> results = Array::New(env->isolate());
 
-    auto add = [&] (bool want_ipv4, bool want_ipv6) -> Maybe<bool> {
+    auto add = [&](bool want_ipv4, bool want_ipv6) -> Maybe<void> {
       for (auto p = res; p != nullptr; p = p->ai_next) {
         CHECK_EQ(p->ai_socktype, SOCK_STREAM);
 
@@ -1471,10 +1472,10 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) {
 
         Local<String> s = OneByteString(env->isolate(), ip);
         if (results->Set(env->context(), n, s).IsNothing())
-          return Nothing<bool>();
+          return Nothing<void>();
         n++;
       }
-      return Just(true);
+      return JustVoid();
     };
 
     switch (order) {

filename: src/node_contextify.cc
patch: @@ -56,7 +56,7 @@ using v8::Int32;
 using v8::Integer;
 using v8::Intercepted;
 using v8::Isolate;
-using v8::Just;
+using v8::JustVoid;
 using v8::KeyCollectionMode;
 using v8::Local;
 using v8::Maybe;
@@ -1108,7 +1108,7 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
   TRACE_EVENT_END0(TRACING_CATEGORY_NODE2(vm, script), "ContextifyScript::New");
 }
 
-Maybe<bool> StoreCodeCacheResult(
+Maybe<void> StoreCodeCacheResult(
     Environment* env,
     Local<Object> target,
     ScriptCompiler::CompileOptions compile_options,
@@ -1117,7 +1117,7 @@ Maybe<bool> StoreCodeCacheResult(
     std::unique_ptr<ScriptCompiler::CachedData> new_cached_data) {
   Local<Context> context;
   if (!target->GetCreationContext().ToLocal(&context)) {
-    return Nothing<bool>();
+    return Nothing<void>();
   }
   if (compile_options == ScriptCompiler::kConsumeCodeCache) {
     if (target
@@ -1126,7 +1126,7 @@ Maybe<bool> StoreCodeCacheResult(
                 env->cached_data_rejected_string(),
                 Boolean::New(env->isolate(), source.GetCachedData()->rejected))
             .IsNothing()) {
-      return Nothing<bool>();
+      return Nothing<void>();
     }
   }
   if (produce_cached_data) {
@@ -1138,18 +1138,18 @@ Maybe<bool> StoreCodeCacheResult(
                        new_cached_data->length);
       if (target->Set(context, env->cached_data_string(), buf.ToLocalChecked())
               .IsNothing()) {
-        return Nothing<bool>();
+        return Nothing<void>();
       }
     }
     if (target
             ->Set(context,
                   env->cached_data_produced_string(),
                   Boolean::New(env->isolate(), cached_data_produced))
             .IsNothing()) {
-      return Nothing<bool>();
+      return Nothing<void>();
     }
   }
-  return Just(true);
+  return JustVoid();
 }
 
 // TODO(RaisinTen): Reuse in ContextifyContext::CompileFunction().

filename: src/node_contextify.h
patch: @@ -176,7 +176,7 @@ class ContextifyScript final : CPPGC_MIXIN(ContextifyScript) {
   v8::TracedReference<v8::UnboundScript> script_;
 };
 
-v8::Maybe<bool> StoreCodeCacheResult(
+v8::Maybe<void> StoreCodeCacheResult(
     Environment* env,
     v8::Local<v8::Object> target,
     v8::ScriptCompiler::CompileOptions compile_options,

filename: src/string_bytes.h
patch: @@ -37,19 +37,19 @@ class StringBytes {
  public:
   class InlineDecoder : public MaybeStackBuffer<char> {
    public:
-    inline v8::Maybe<bool> Decode(Environment* env,
+    inline v8::Maybe<void> Decode(Environment* env,
                                   v8::Local<v8::String> string,
                                   enum encoding enc) {
       size_t storage;
       if (!StringBytes::StorageSize(env->isolate(), string, enc).To(&storage))
-        return v8::Nothing<bool>();
+        return v8::Nothing<void>();
       AllocateSufficientStorage(storage);
       const size_t length =
           StringBytes::Write(env->isolate(), out(), storage, string, enc);
 
       // No zero terminator is included when using this method.
       SetLength(length);
-      return v8::Just(true);
+      return v8::JustVoid();
     }
 
     inline size_t size() const { return length(); }