Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f332c4c

Browse filesBrowse 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
Copy full SHA for f332c4c

File tree

Expand file treeCollapse file tree

4 files changed

+15
-14
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+15
-14
lines changed
Open diff view settings
Collapse file

‎src/cares_wrap.cc‎

Copy file name to clipboardExpand all lines: src/cares_wrap.cc
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ using v8::Int32;
6666
using v8::Integer;
6767
using v8::Isolate;
6868
using v8::Just;
69+
using v8::JustVoid;
6970
using v8::Local;
7071
using v8::Maybe;
7172
using v8::Nothing;
@@ -1450,7 +1451,7 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) {
14501451
if (status == 0) {
14511452
Local<Array> results = Array::New(env->isolate());
14521453

1453-
auto add = [&] (bool want_ipv4, bool want_ipv6) -> Maybe<bool> {
1454+
auto add = [&](bool want_ipv4, bool want_ipv6) -> Maybe<void> {
14541455
for (auto p = res; p != nullptr; p = p->ai_next) {
14551456
CHECK_EQ(p->ai_socktype, SOCK_STREAM);
14561457

@@ -1471,10 +1472,10 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) {
14711472

14721473
Local<String> s = OneByteString(env->isolate(), ip);
14731474
if (results->Set(env->context(), n, s).IsNothing())
1474-
return Nothing<bool>();
1475+
return Nothing<void>();
14751476
n++;
14761477
}
1477-
return Just(true);
1478+
return JustVoid();
14781479
};
14791480

14801481
switch (order) {
Collapse file

‎src/node_contextify.cc‎

Copy file name to clipboardExpand all lines: src/node_contextify.cc
+7-7Lines 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().
Collapse file

‎src/node_contextify.h‎

Copy file name to clipboardExpand all lines: src/node_contextify.h
+1-1Lines 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,
Collapse file

‎src/string_bytes.h‎

Copy file name to clipboardExpand all lines: src/string_bytes.h
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,19 @@ class StringBytes {
3737
public:
3838
class InlineDecoder : public MaybeStackBuffer<char> {
3939
public:
40-
inline v8::Maybe<bool> Decode(Environment* env,
40+
inline v8::Maybe<void> Decode(Environment* env,
4141
v8::Local<v8::String> string,
4242
enum encoding enc) {
4343
size_t storage;
4444
if (!StringBytes::StorageSize(env->isolate(), string, enc).To(&storage))
45-
return v8::Nothing<bool>();
45+
return v8::Nothing<void>();
4646
AllocateSufficientStorage(storage);
4747
const size_t length =
4848
StringBytes::Write(env->isolate(), out(), storage, string, enc);
4949

5050
// No zero terminator is included when using this method.
5151
SetLength(length);
52-
return v8::Just(true);
52+
return v8::JustVoid();
5353
}
5454

5555
inline size_t size() const { return length(); }

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.