Skip to content

Commit 03108af

Browse files
committed
Manifest: define keywords as global
1 parent 69cd916 commit 03108af

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Manifest.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ static const fs::path GIT_SRC_DIR(GIT_DIR / "src");
4040
static const std::unordered_set<char> ALLOWED_CHARS = {
4141
'-', '_', '/', '.', '+' // allowed in the dependency name
4242
};
43+
static const std::unordered_set<std::string_view> KEYWORDS = {
44+
#include "Keywords.def"
45+
};
4346

4447
Result<Edition>
4548
Edition::tryFromString(std::string str) noexcept {
@@ -550,11 +553,7 @@ validatePackageName(const std::string_view name) noexcept {
550553
std::isalnum(name[name.size() - 1]),
551554
"package name must end with a letter or digit"
552555
);
553-
554-
const std::unordered_set<std::string_view> keywords = {
555-
#include "Keywords.def"
556-
};
557-
Ensure(!keywords.contains(name), "package name must not be a C++ keyword");
556+
Ensure(!KEYWORDS.contains(name), "package name must not be a C++ keyword");
558557

559558
return Ok();
560559
}

0 commit comments

Comments
 (0)