LibJS+LibUnicode: Supply field type in CalendarPattern's for-each method

Some callers will want different behavior depending on what field is
being provided to the callback.
This commit is contained in:
Timothy Flynn 2021-12-07 08:40:06 -05:00 committed by Linus Groh
parent 80ea6e664d
commit 6ace4000bf
Notes: sideshowbarker 2024-07-17 23:05:27 +09:00
3 changed files with 32 additions and 18 deletions

View file

@ -499,11 +499,11 @@ static void generate_missing_patterns(Calendar& calendar, Vector<CalendarPattern
format.pattern12_index = replace_pattern(format.pattern_index, time_format.pattern12_index, date_format.pattern_index);
format.pattern_index = replace_pattern(format.pattern_index, time_format.pattern_index, date_format.pattern_index);
format.for_each_calendar_field_zipped_with(date_format, [](auto& field, auto const& date_field) {
format.for_each_calendar_field_zipped_with(date_format, [](auto& field, auto const& date_field, auto) {
if (date_field.has_value())
field = date_field;
});
format.for_each_calendar_field_zipped_with(time_format, [](auto& field, auto const& time_field) {
format.for_each_calendar_field_zipped_with(time_format, [](auto& field, auto const& time_field, auto) {
if (time_field.has_value())
field = time_field;
});