Skip to content

Commit

Permalink
src: use Maybe<void> in ProcessEmitWarningSync
Browse files Browse the repository at this point in the history
Signed-off-by: Daeyeon Jeong <[email protected]>
PR-URL: #57250
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
daeyeon authored Mar 6, 2025
1 parent 5401ac6 commit 117c1ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/node_process.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ inline v8::Maybe<bool> ProcessEmitWarning(Environment* env,
const char* fmt,
Args&&... args);

v8::Maybe<bool> ProcessEmitWarningSync(Environment* env,
v8::Maybe<void> ProcessEmitWarningSync(Environment* env,
std::string_view message);
v8::Maybe<bool> ProcessEmitExperimentalWarning(Environment* env,
const std::string& warning);
Expand Down
9 changes: 5 additions & 4 deletions src/node_process_events.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ using v8::Function;
using v8::HandleScope;
using v8::Isolate;
using v8::Just;
using v8::JustVoid;
using v8::Local;
using v8::Maybe;
using v8::MaybeLocal;
Expand All @@ -19,7 +20,7 @@ using v8::Object;
using v8::String;
using v8::Value;

Maybe<bool> ProcessEmitWarningSync(Environment* env, std::string_view message) {
Maybe<void> ProcessEmitWarningSync(Environment* env, std::string_view message) {
Isolate* isolate = env->isolate();
Local<Context> context = env->context();
Local<String> message_string;
Expand All @@ -28,7 +29,7 @@ Maybe<bool> ProcessEmitWarningSync(Environment* env, std::string_view message) {
NewStringType::kNormal,
static_cast<int>(message.size()))
.ToLocal(&message_string)) {
return Nothing<bool>();
return Nothing<void>();
}

Local<Value> argv[] = {message_string};
Expand All @@ -39,9 +40,9 @@ Maybe<bool> ProcessEmitWarningSync(Environment* env, std::string_view message) {
if (emit_function.As<Function>()
->Call(context, v8::Undefined(isolate), arraysize(argv), argv)
.IsEmpty()) {
return Nothing<bool>();
return Nothing<void>();
}
return Just(true);
return JustVoid();
}

MaybeLocal<Value> ProcessEmit(Environment* env,
Expand Down

0 comments on commit 117c1ca

Please sign in to comment.