diff --git a/Userland/Libraries/LibJS/Runtime/Intl/Locale.cpp b/Userland/Libraries/LibJS/Runtime/Intl/Locale.cpp index cd74aabc0c..6cf7d9c155 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/Locale.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/Locale.cpp @@ -206,7 +206,7 @@ static u8 weekday_to_integer(Optional<::Locale::Weekday> weekday, ::Locale::Week VERIFY_NOT_REACHED(); } -static ThrowCompletionOr> weekend_of_locale(VM& vm, StringView locale) +static Vector weekend_of_locale(StringView locale) { auto weekend_start = weekday_to_integer(::Locale::get_locale_weekend_start(locale), ::Locale::Weekday::Saturday); auto weekend_end = weekday_to_integer(::Locale::get_locale_weekend_end(locale), ::Locale::Weekday::Sunday); @@ -216,7 +216,7 @@ static ThrowCompletionOr> weekend_of_locale(VM& vm, StringView locale VERIFY(weekend_start <= weekend_end); Vector weekend; - TRY_OR_THROW_OOM(vm, weekend.try_ensure_capacity(weekend_end - weekend_start + 1)); + weekend.ensure_capacity(weekend_end - weekend_start + 1); for (auto day = weekend_start; day <= weekend_end; ++day) weekend.unchecked_append(day); @@ -225,7 +225,7 @@ static ThrowCompletionOr> weekend_of_locale(VM& vm, StringView locale } // 1.1.8 WeekInfoOfLocale ( loc ), https://tc39.es/proposal-intl-locale-info/#sec-week-info-of-locale -ThrowCompletionOr week_info_of_locale(VM& vm, Locale const& locale_object) +WeekInfo week_info_of_locale(Locale const& locale_object) { // 1. Let locale be loc.[[Locale]]. auto const& locale = locale_object.locale(); @@ -237,7 +237,7 @@ ThrowCompletionOr week_info_of_locale(VM& vm, Locale const& locale_obj WeekInfo week_info {}; week_info.minimal_days = ::Locale::get_locale_minimum_days(locale).value_or(1); week_info.first_day = weekday_to_integer(::Locale::get_locale_first_day(locale), ::Locale::Weekday::Monday); - week_info.weekend = MUST_OR_THROW_OOM(weekend_of_locale(vm, locale)); + week_info.weekend = weekend_of_locale(locale); return week_info; } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/Locale.h b/Userland/Libraries/LibJS/Runtime/Intl/Locale.h index c103b66ea6..a6e66309eb 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/Locale.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/Locale.h @@ -88,6 +88,6 @@ NonnullGCPtr hour_cycles_of_locale(VM&, Locale const& locale); NonnullGCPtr numbering_systems_of_locale(VM&, Locale const&); NonnullGCPtr time_zones_of_locale(VM&, StringView region); StringView character_direction_of_locale(Locale const&); -ThrowCompletionOr week_info_of_locale(VM&, Locale const&); +WeekInfo week_info_of_locale(Locale const&); } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp index b4cc2ac2db..e48df93887 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp @@ -105,7 +105,7 @@ static ThrowCompletionOr apply_options_to_tag(VM& vm, StringView tag, Ob } // 14.1.3 ApplyUnicodeExtensionToTag ( tag, options, relevantExtensionKeys ), https://tc39.es/ecma402/#sec-apply-unicode-extension-to-tag -static ThrowCompletionOr apply_unicode_extension_to_tag(VM& vm, StringView tag, LocaleAndKeys options, ReadonlySpan relevant_extension_keys) +static LocaleAndKeys apply_unicode_extension_to_tag(StringView tag, LocaleAndKeys options, ReadonlySpan relevant_extension_keys) { // 1. Assert: Type(tag) is String. // 2. Assert: tag matches the unicode_locale_id production. @@ -188,7 +188,7 @@ static ThrowCompletionOr apply_unicode_extension_to_tag(VM& vm, S // iv. Else, else { // 1. Append the Record { [[Key]]: key, [[Value]]: value } to keywords. - TRY_OR_THROW_OOM(vm, keywords.try_append({ TRY_OR_THROW_OOM(vm, String::from_utf8(key)), *value })); + keywords.append({ MUST(String::from_utf8(key)), *value }); } } @@ -322,7 +322,7 @@ ThrowCompletionOr> LocaleConstructor::construct(FunctionObj opt.nu = TRY(get_string_option(vm, *options, vm.names.numberingSystem, ::Locale::is_type_identifier)); // 29. Let r be ! ApplyUnicodeExtensionToTag(tag, opt, relevantExtensionKeys). - auto result = MUST_OR_THROW_OOM(apply_unicode_extension_to_tag(vm, tag, move(opt), relevant_extension_keys)); + auto result = apply_unicode_extension_to_tag(tag, move(opt), relevant_extension_keys); // 30. Set locale.[[Locale]] to r.[[locale]]. locale->set_locale(move(result.locale)); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp index 5f5416aaec..f7d52764a9 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp @@ -283,7 +283,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::week_info) auto info = Object::create(realm, realm.intrinsics().object_prototype()); // 4. Let wi be ! WeekInfoOfLocale(loc). - auto week_info = MUST_OR_THROW_OOM(week_info_of_locale(vm, locale_object)); + auto week_info = week_info_of_locale(locale_object); // 5. Let we be ! CreateArrayFromList( wi.[[Weekend]] ). auto weekend = Array::create_from(realm, week_info.weekend, [](auto day) { return Value(day); });