LibUnicode: Sort generated enums case-insensitively
This hasn't mattered yet by chance, because the source for all enums contains names of the same case. But the enum generated for hour cycle regions will have mixed case. Sort them case-insensitively in order to traverse these names in the same order in both generate_enum and generate_mapping.
This commit is contained in:
parent
7872934861
commit
15fc03ef34
Notes:
sideshowbarker
2024-07-17 23:22:41 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/15fc03ef34b Pull-request: https://github.com/SerenityOS/serenity/pull/11128 Reviewed-by: https://github.com/linusg ✅
1 changed files with 2 additions and 2 deletions
|
@ -247,8 +247,8 @@ Optional<@return_type@> @method_name@(StringView key)
|
|||
template<typename IdentifierFormatter>
|
||||
void generate_enum(SourceGenerator& generator, IdentifierFormatter&& format_identifier, StringView name, StringView default_, Vector<String>& values, Vector<Alias> aliases = {})
|
||||
{
|
||||
quick_sort(values);
|
||||
quick_sort(aliases, [](auto const& alias1, auto const& alias2) { return alias1.alias < alias2.alias; });
|
||||
quick_sort(values, [](auto const& value1, auto const& value2) { return value1.to_lowercase() < value2.to_lowercase(); });
|
||||
quick_sort(aliases, [](auto const& alias1, auto const& alias2) { return alias1.alias.to_lowercase() < alias2.alias.to_lowercase(); });
|
||||
|
||||
generator.set("name", name);
|
||||
generator.set("underlying", ((values.size() + !default_.is_empty()) < 256) ? "u8"sv : "u16"sv);
|
||||
|
|
Loading…
Add table
Reference in a new issue