src: use `Maybe<void>` where bool isn't needed · nodejs/node@f332c4c · GitHub
Skip to content

Commit f332c4c

Browse files
committed
src: use Maybe<void> where bool isn't needed
PR-URL: #54575 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent 29866ca commit f332c4c

4 files changed

Lines changed: 15 additions & 14 deletions

File tree

src/cares_wrap.cc

Lines changed: 4 additions & 3 deletions

src/node_contextify.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ using v8::Int32;
5555
using v8::Integer;
5656
using v8::Intercepted;
5757
using v8::Isolate;
58-
using v8::Just;
58+
using v8::JustVoid;
5959
using v8::KeyCollectionMode;
6060
using v8::Local;
6161
using v8::Maybe;
@@ -1104,7 +1104,7 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
11041104
TRACE_EVENT_END0(TRACING_CATEGORY_NODE2(vm, script), "ContextifyScript::New");
11051105
}
11061106

1107-
Maybe<bool> StoreCodeCacheResult(
1107+
Maybe<void> StoreCodeCacheResult(
11081108
Environment* env,
11091109
Local<Object> target,
11101110
ScriptCompiler::CompileOptions compile_options,
@@ -1113,7 +1113,7 @@ Maybe<bool> StoreCodeCacheResult(
11131113
std::unique_ptr<ScriptCompiler::CachedData> new_cached_data) {
11141114
Local<Context> context;
11151115
if (!target->GetCreationContext().ToLocal(&context)) {
1116-
return Nothing<bool>();
1116+
return Nothing<void>();
11171117
}
11181118
if (compile_options == ScriptCompiler::kConsumeCodeCache) {
11191119
if (target
@@ -1122,7 +1122,7 @@ Maybe<bool> StoreCodeCacheResult(
11221122
env->cached_data_rejected_string(),
11231123
Boolean::New(env->isolate(), source.GetCachedData()->rejected))
11241124
.IsNothing()) {
1125-
return Nothing<bool>();
1125+
return Nothing<void>();
11261126
}
11271127
}
11281128
if (produce_cached_data) {
@@ -1134,18 +1134,18 @@ Maybe<bool> StoreCodeCacheResult(
11341134
new_cached_data->length);
11351135
if (target->Set(context, env->cached_data_string(), buf.ToLocalChecked())
11361136
.IsNothing()) {
1137-
return Nothing<bool>();
1137+
return Nothing<void>();
11381138
}
11391139
}
11401140
if (target
11411141
->Set(context,
11421142
env->cached_data_produced_string(),
11431143
Boolean::New(env->isolate(), cached_data_produced))
11441144
.IsNothing()) {
1145-
return Nothing<bool>();
1145+
return Nothing<void>();
11461146
}
11471147
}
1148-
return Just(true);
1148+
return JustVoid();
11491149
}
11501150

11511151
// TODO(RaisinTen): Reuse in ContextifyContext::CompileFunction().

src/node_contextify.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class ContextifyScript : public BaseObject {
177177
v8::Global<v8::UnboundScript> script_;
178178
};
179179

180-
v8::Maybe<bool> StoreCodeCacheResult(
180+
v8::Maybe<void> StoreCodeCacheResult(
181181
Environment* env,
182182
v8::Local<v8::Object> target,
183183
v8::ScriptCompiler::CompileOptions compile_options,

src/string_bytes.h

Lines changed: 3 additions & 3 deletions

0 commit comments

Comments
 (0)