1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:07:35 +00:00

LibJS+LibLocale: Propagate OOM from CLDR NumberFormat Vector operations

This commit is contained in:
Timothy Flynn 2023-02-02 19:54:47 -05:00 committed by Linus Groh
parent 858126d236
commit 89da8de4ca
4 changed files with 13 additions and 13 deletions

View file

@ -1317,7 +1317,7 @@ ThrowCompletionOr<Optional<Variant<StringView, String>>> get_number_format_patte
// i. Let unit be "fallback".
// e. Let patterns be patterns.[[<unit>]].
// f. Let patterns be patterns.[[<unitDisplay>]].
auto formats = ::Locale::get_unit_formats(number_format.data_locale(), number_format.unit(), number_format.unit_display());
auto formats = TRY_OR_THROW_OOM(vm, ::Locale::get_unit_formats(number_format.data_locale(), number_format.unit(), number_format.unit_display()));
auto plurality = MUST_OR_THROW_OOM(resolve_plural(vm, number_format, ::Locale::PluralForm::Cardinal, number.to_value(vm)));
if (auto it = formats.find_if([&](auto& p) { return p.plurality == plurality.plural_category; }); it != formats.end())

View file

@ -20,7 +20,7 @@ ErrorOr<Optional<StringView>> __attribute__((weak)) get_number_system_symbol(Str
ErrorOr<Optional<NumberGroupings>> __attribute__((weak)) get_number_system_groupings(StringView, StringView) { return OptionalNone {}; }
ErrorOr<Optional<NumberFormat>> __attribute__((weak)) get_standard_number_system_format(StringView, StringView, StandardNumberFormatType) { return OptionalNone {}; }
ErrorOr<Vector<NumberFormat>> __attribute__((weak)) get_compact_number_system_formats(StringView, StringView, CompactNumberFormatType) { return Vector<NumberFormat> {}; }
Vector<NumberFormat> __attribute__((weak)) get_unit_formats(StringView, StringView, Style) { return {}; }
ErrorOr<Vector<NumberFormat>> __attribute__((weak)) get_unit_formats(StringView, StringView, Style) { return Vector<NumberFormat> {}; }
Optional<Span<u32 const>> __attribute__((weak)) get_digits_for_number_system(StringView)
{

View file

@ -69,7 +69,7 @@ ErrorOr<String> replace_digits_for_number_system(StringView system, StringView n
ErrorOr<Optional<NumberFormat>> get_standard_number_system_format(StringView locale, StringView system, StandardNumberFormatType type);
ErrorOr<Vector<NumberFormat>> get_compact_number_system_formats(StringView locale, StringView system, CompactNumberFormatType type);
Vector<NumberFormat> get_unit_formats(StringView locale, StringView unit, Style style);
ErrorOr<Vector<NumberFormat>> get_unit_formats(StringView locale, StringView unit, Style style);
ErrorOr<Optional<String>> augment_currency_format_pattern(StringView currency_display, StringView base_pattern);
ErrorOr<Optional<String>> augment_range_pattern(StringView range_separator, StringView lower, StringView upper);