Skip to content

Commit

Permalink
src: use std::nullopt instead of {}
Browse files Browse the repository at this point in the history
It expresses the intent in a clearer way.

Refs: nodejs#48191 (comment)
Signed-off-by: Darshan Sen <raisinten@gmail.com>
  • Loading branch information
RaisinTen committed Jun 27, 2023
1 parent 657764b commit ee798d6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/node_sea.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,12 @@ std::optional<std::string> GenerateCodeCache(std::string_view main_path,

Local<String> filename;
if (!String::NewFromUtf8(isolate, main_path.data()).ToLocal(&filename)) {
return {};
return std::nullopt;
}

Local<String> content;
if (!String::NewFromUtf8(isolate, main_script.data()).ToLocal(&content)) {
return {};
return std::nullopt;
}

std::vector<Local<String>> parameters = {
Expand All @@ -312,7 +312,7 @@ std::optional<std::string> GenerateCodeCache(std::string_view main_path,
if (!contextify::CompileFunction(
isolate, context, filename, content, std::move(parameters))
.ToLocal(&fn)) {
return {};
return std::nullopt;
}

std::unique_ptr<ScriptCompiler::CachedData> cache{
Expand Down

0 comments on commit ee798d6

Please sign in to comment.