From 15fc03ef34b56823c0dbc154052c80ea0aaff07f Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Mon, 29 Nov 2021 07:36:42 -0500 Subject: [PATCH] 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. --- Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h index 5726465dfa..a2acd2de83 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h +++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h @@ -247,8 +247,8 @@ Optional<@return_type@> @method_name@(StringView key) template void generate_enum(SourceGenerator& generator, IdentifierFormatter&& format_identifier, StringView name, StringView default_, Vector& values, Vector 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);