Skip to content

Commit

Permalink
Fix usage of absl::StrReplaceAll
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-skydio committed Apr 18, 2024
1 parent 7effd01 commit 6350195
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions generator/js_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ bool IsReserved(const std::string& ident) {

std::string GetSnakeFilename(const std::string& filename) {
std::string snake_name = filename;
absl::StrReplaceAll(snake_name, {{"/", "_"}});
return snake_name;
return absl::StrReplaceAll(snake_name, {{"/", "_"}});
}

// Given a filename like foo/bar/baz.proto, returns the corresponding JavaScript
Expand Down Expand Up @@ -147,9 +146,9 @@ std::string ModuleAlias(const std::string& filename) {
// We'll worry about this problem if/when we actually see it. This name isn't
// exposed to users so we can change it later if we need to.
std::string basename = StripProto(filename);
absl::StrReplaceAll(basename, {{"-", "$"}});
absl::StrReplaceAll(basename, {{"/", "_"}});
absl::StrReplaceAll(basename, {{".", "_"}});
basename = absl::StrReplaceAll(basename, {{"-", "$"}});
basename = absl::StrReplaceAll(basename, {{"/", "_"}});
basename = absl::StrReplaceAll(basename, {{".", "_"}});
return basename + "_pb";
}

Expand Down

0 comments on commit 6350195

Please sign in to comment.