diff options
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Intl')
20 files changed, 81 insertions, 81 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp index c70fed0ef5..c418d1215c 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp @@ -306,7 +306,7 @@ static MatcherResult lookup_matcher(Vector<DeprecatedString> const& requested_lo // a. Let noExtensionsLocale be the String value that is locale with any Unicode locale extension sequences removed. auto extensions = locale_id->remove_extension_type<::Locale::LocaleExtension>(); - auto no_extensions_locale = locale_id->to_string(); + auto no_extensions_locale = locale_id->to_deprecated_string(); // b. Let availableLocale be ! BestAvailableLocale(availableLocales, noExtensionsLocale). auto available_locale = best_available_locale(no_extensions_locale); @@ -383,7 +383,7 @@ LocaleResult resolve_locale(Vector<DeprecatedString> const& requested_locales, L MatcherResult matcher_result; // 2. If matcher is "lookup", then - if (matcher.is_string() && (matcher.as_string().string() == "lookup"sv)) { + if (matcher.is_string() && (matcher.as_string().deprecated_string() == "lookup"sv)) { // a. Let r be ! LookupMatcher(availableLocales, requestedLocales). matcher_result = lookup_matcher(requested_locales); } @@ -538,7 +538,7 @@ Vector<DeprecatedString> lookup_supported_locales(Vector<DeprecatedString> const // a. Let noExtensionsLocale be the String value that is locale with any Unicode locale extension sequences removed. locale_id->remove_extension_type<::Locale::LocaleExtension>(); - auto no_extensions_locale = locale_id->to_string(); + auto no_extensions_locale = locale_id->to_deprecated_string(); // b. Let availableLocale be ! BestAvailableLocale(availableLocales, noExtensionsLocale). auto available_locale = best_available_locale(no_extensions_locale); @@ -578,7 +578,7 @@ ThrowCompletionOr<Array*> supported_locales(VM& vm, Vector<DeprecatedString> con Vector<DeprecatedString> supported_locales; // 3. If matcher is "best fit", then - if (matcher.as_string().string() == "best fit"sv) { + if (matcher.as_string().deprecated_string() == "best fit"sv) { // a. Let supportedLocales be BestFitSupportedLocales(availableLocales, requestedLocales). supported_locales = best_fit_supported_locales(requested_locales); } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.cpp index 93baa46ba1..9240f0e8fa 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.cpp @@ -27,7 +27,7 @@ static ThrowCompletionOr<Collator*> initialize_collator(VM& vm, Collator& collat auto usage = TRY(get_option(vm, *options, vm.names.usage, OptionType::String, { "sort"sv, "search"sv }, "sort"sv)); // 4. Set collator.[[Usage]] to usage. - collator.set_usage(usage.as_string().string()); + collator.set_usage(usage.as_string().deprecated_string()); // 5. If usage is "sort", then // a. Let localeData be %Collator%.[[SortLocaleData]]. @@ -49,11 +49,11 @@ static ThrowCompletionOr<Collator*> initialize_collator(VM& vm, Collator& collat // 11. If collation is not undefined, then if (!collation.is_undefined()) { // a. If collation does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception. - if (!::Locale::is_type_identifier(collation.as_string().string())) + if (!::Locale::is_type_identifier(collation.as_string().deprecated_string())) return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, collation, "collation"sv); // 12. Set opt.[[co]] to collation. - opt.co = collation.as_string().string(); + opt.co = collation.as_string().deprecated_string(); } // 13. Let numeric be ? GetOption(options, "numeric", "boolean", undefined, undefined). @@ -69,7 +69,7 @@ static ThrowCompletionOr<Collator*> initialize_collator(VM& vm, Collator& collat // 17. Set opt.[[kf]] to caseFirst. auto case_first = TRY(get_option(vm, *options, vm.names.caseFirst, OptionType::String, { "upper"sv, "lower"sv, "false"sv }, Empty {})); if (!case_first.is_undefined()) - opt.kf = case_first.as_string().string(); + opt.kf = case_first.as_string().deprecated_string(); // 18. Let relevantExtensionKeys be %Collator%.[[RelevantExtensionKeys]]. auto relevant_extension_keys = Collator::relevant_extension_keys(); @@ -117,7 +117,7 @@ static ThrowCompletionOr<Collator*> initialize_collator(VM& vm, Collator& collat } // 28. Set collator.[[Sensitivity]] to sensitivity. - collator.set_sensitivity(sensitivity.as_string().string()); + collator.set_sensitivity(sensitivity.as_string().deprecated_string()); // 29. Let ignorePunctuation be ? GetOption(options, "ignorePunctuation", "boolean", undefined, false). auto ignore_punctuation = TRY(get_option(vm, *options, vm.names.ignorePunctuation, OptionType::Boolean, {}, false)); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp index 63e6ed52de..5e85043ac8 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp @@ -106,11 +106,11 @@ ThrowCompletionOr<DateTimeFormat*> initialize_date_time_format(VM& vm, DateTimeF // 7. If calendar is not undefined, then if (!calendar.is_undefined()) { // a. If calendar does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception. - if (!::Locale::is_type_identifier(calendar.as_string().string())) + if (!::Locale::is_type_identifier(calendar.as_string().deprecated_string())) return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, calendar, "calendar"sv); // 8. Set opt.[[ca]] to calendar. - opt.ca = calendar.as_string().string(); + opt.ca = calendar.as_string().deprecated_string(); } // 9. Let numberingSystem be ? GetOption(options, "numberingSystem", "string", undefined, undefined). @@ -119,11 +119,11 @@ ThrowCompletionOr<DateTimeFormat*> initialize_date_time_format(VM& vm, DateTimeF // 10. If numberingSystem is not undefined, then if (!numbering_system.is_undefined()) { // a. If numberingSystem does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception. - if (!::Locale::is_type_identifier(numbering_system.as_string().string())) + if (!::Locale::is_type_identifier(numbering_system.as_string().deprecated_string())) return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, numbering_system, "numberingSystem"sv); // 11. Set opt.[[nu]] to numberingSystem. - opt.nu = numbering_system.as_string().string(); + opt.nu = numbering_system.as_string().deprecated_string(); } // 12. Let hour12 be ? GetOption(options, "hour12", "boolean", undefined, undefined). @@ -140,7 +140,7 @@ ThrowCompletionOr<DateTimeFormat*> initialize_date_time_format(VM& vm, DateTimeF // 15. Set opt.[[hc]] to hourCycle. if (!hour_cycle.is_nullish()) - opt.hc = hour_cycle.as_string().string(); + opt.hc = hour_cycle.as_string().deprecated_string(); // 16. Let localeData be %DateTimeFormat%.[[LocaleData]]. // 17. Let r be ResolveLocale(%DateTimeFormat%.[[AvailableLocales]], requestedLocales, opt, %DateTimeFormat%.[[RelevantExtensionKeys]], localeData). @@ -275,7 +275,7 @@ ThrowCompletionOr<DateTimeFormat*> initialize_date_time_format(VM& vm, DateTimeF // d. Set formatOptions.[[<prop>]] to value. if (!value.is_undefined()) { - option = ::Locale::calendar_pattern_style_from_string(value.as_string().string()); + option = ::Locale::calendar_pattern_style_from_string(value.as_string().deprecated_string()); // e. If value is not undefined, then // i. Set hasExplicitFormatComponents to true. @@ -294,14 +294,14 @@ ThrowCompletionOr<DateTimeFormat*> initialize_date_time_format(VM& vm, DateTimeF // 39. Set dateTimeFormat.[[DateStyle]] to dateStyle. if (!date_style.is_undefined()) - date_time_format.set_date_style(date_style.as_string().string()); + date_time_format.set_date_style(date_style.as_string().deprecated_string()); // 40. Let timeStyle be ? GetOption(options, "timeStyle", "string", « "full", "long", "medium", "short" », undefined). auto time_style = TRY(get_option(vm, *options, vm.names.timeStyle, OptionType::String, AK::Array { "full"sv, "long"sv, "medium"sv, "short"sv }, Empty {})); // 41. Set dateTimeFormat.[[TimeStyle]] to timeStyle. if (!time_style.is_undefined()) - date_time_format.set_time_style(time_style.as_string().string()); + date_time_format.set_time_style(time_style.as_string().deprecated_string()); Optional<::Locale::CalendarPattern> best_format {}; @@ -323,7 +323,7 @@ ThrowCompletionOr<DateTimeFormat*> initialize_date_time_format(VM& vm, DateTimeF auto formats = ::Locale::get_calendar_available_formats(data_locale, date_time_format.calendar()); // b. If matcher is "basic", then - if (matcher.as_string().string() == "basic"sv) { + if (matcher.as_string().deprecated_string() == "basic"sv) { // i. Let bestFormat be BasicFormatMatcher(formatOptions, formats). best_format = basic_format_matcher(format_options, move(formats)); } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesConstructor.cpp index 167dcdb9fe..89c9b950b2 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesConstructor.cpp @@ -82,7 +82,7 @@ ThrowCompletionOr<Object*> DisplayNamesConstructor::construct(FunctionObject& ne auto style = TRY(get_option(vm, *options, vm.names.style, OptionType::String, { "narrow"sv, "short"sv, "long"sv }, "long"sv)); // 12. Set displayNames.[[Style]] to style. - display_names->set_style(style.as_string().string()); + display_names->set_style(style.as_string().deprecated_string()); // 13. Let type be ? GetOption(options, "type", "string", « "language", "region", "script", "currency", "calendar", "dateTimeField" », undefined). auto type = TRY(get_option(vm, *options, vm.names.type, OptionType::String, { "language"sv, "region"sv, "script"sv, "currency"sv, "calendar"sv, "dateTimeField"sv }, Empty {})); @@ -92,13 +92,13 @@ ThrowCompletionOr<Object*> DisplayNamesConstructor::construct(FunctionObject& ne return vm.throw_completion<TypeError>(ErrorType::IsUndefined, "options.type"sv); // 15. Set displayNames.[[Type]] to type. - display_names->set_type(type.as_string().string()); + display_names->set_type(type.as_string().deprecated_string()); // 16. Let fallback be ? GetOption(options, "fallback", "string", « "code", "none" », "code"). auto fallback = TRY(get_option(vm, *options, vm.names.fallback, OptionType::String, { "code"sv, "none"sv }, "code"sv)); // 17. Set displayNames.[[Fallback]] to fallback. - display_names->set_fallback(fallback.as_string().string()); + display_names->set_fallback(fallback.as_string().deprecated_string()); // 18. Set displayNames.[[Locale]] to r.[[locale]]. display_names->set_locale(move(result.locale)); @@ -119,7 +119,7 @@ ThrowCompletionOr<Object*> DisplayNamesConstructor::construct(FunctionObject& ne // 26. If type is "language", then if (display_names->type() == DisplayNames::Type::Language) { // a. Set displayNames.[[LanguageDisplay]] to languageDisplay. - display_names->set_language_display(language_display.as_string().string()); + display_names->set_language_display(language_display.as_string().deprecated_string()); // b. Let typeFields be typeFields.[[<languageDisplay>]]. // c. Assert: typeFields is a Record (see 12.4.3). diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp index d88c6d3336..a0fd0bf7af 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp @@ -47,7 +47,7 @@ JS_DEFINE_NATIVE_FUNCTION(DisplayNamesPrototype::of) code = js_string(vm, move(code_string)); // 4. Let code be ? CanonicalCodeForDisplayNames(displayNames.[[Type]], code). - code = TRY(canonical_code_for_display_names(vm, display_names->type(), code.as_string().string())); + code = TRY(canonical_code_for_display_names(vm, display_names->type(), code.as_string().deprecated_string())); // 5. Let fields be displayNames.[[Fields]]. // 6. If fields has a field [[<code>]], return fields.[[<code>]]. @@ -57,48 +57,48 @@ JS_DEFINE_NATIVE_FUNCTION(DisplayNamesPrototype::of) switch (display_names->type()) { case DisplayNames::Type::Language: if (display_names->language_display() == DisplayNames::LanguageDisplay::Dialect) { - result = ::Locale::get_locale_language_mapping(display_names->locale(), code.as_string().string()); + result = ::Locale::get_locale_language_mapping(display_names->locale(), code.as_string().deprecated_string()); if (result.has_value()) break; } - if (auto locale = is_structurally_valid_language_tag(code.as_string().string()); locale.has_value()) + if (auto locale = is_structurally_valid_language_tag(code.as_string().deprecated_string()); locale.has_value()) formatted_result = ::Locale::format_locale_for_display(display_names->locale(), locale.release_value()); break; case DisplayNames::Type::Region: - result = ::Locale::get_locale_territory_mapping(display_names->locale(), code.as_string().string()); + result = ::Locale::get_locale_territory_mapping(display_names->locale(), code.as_string().deprecated_string()); break; case DisplayNames::Type::Script: - result = ::Locale::get_locale_script_mapping(display_names->locale(), code.as_string().string()); + result = ::Locale::get_locale_script_mapping(display_names->locale(), code.as_string().deprecated_string()); break; case DisplayNames::Type::Currency: switch (display_names->style()) { case ::Locale::Style::Long: - result = ::Locale::get_locale_long_currency_mapping(display_names->locale(), code.as_string().string()); + result = ::Locale::get_locale_long_currency_mapping(display_names->locale(), code.as_string().deprecated_string()); break; case ::Locale::Style::Short: - result = ::Locale::get_locale_short_currency_mapping(display_names->locale(), code.as_string().string()); + result = ::Locale::get_locale_short_currency_mapping(display_names->locale(), code.as_string().deprecated_string()); break; case ::Locale::Style::Narrow: - result = ::Locale::get_locale_narrow_currency_mapping(display_names->locale(), code.as_string().string()); + result = ::Locale::get_locale_narrow_currency_mapping(display_names->locale(), code.as_string().deprecated_string()); break; default: VERIFY_NOT_REACHED(); } break; case DisplayNames::Type::Calendar: - result = ::Locale::get_locale_calendar_mapping(display_names->locale(), code.as_string().string()); + result = ::Locale::get_locale_calendar_mapping(display_names->locale(), code.as_string().deprecated_string()); break; case DisplayNames::Type::DateTimeField: switch (display_names->style()) { case ::Locale::Style::Long: - result = ::Locale::get_locale_long_date_field_mapping(display_names->locale(), code.as_string().string()); + result = ::Locale::get_locale_long_date_field_mapping(display_names->locale(), code.as_string().deprecated_string()); break; case ::Locale::Style::Short: - result = ::Locale::get_locale_short_date_field_mapping(display_names->locale(), code.as_string().string()); + result = ::Locale::get_locale_short_date_field_mapping(display_names->locale(), code.as_string().deprecated_string()); break; case ::Locale::Style::Narrow: - result = ::Locale::get_locale_narrow_date_field_mapping(display_names->locale(), code.as_string().string()); + result = ::Locale::get_locale_narrow_date_field_mapping(display_names->locale(), code.as_string().deprecated_string()); break; default: VERIFY_NOT_REACHED(); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.cpp index 7c6f32337e..ce8b24b665 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.cpp @@ -272,7 +272,7 @@ ThrowCompletionOr<DurationUnitOptions> get_duration_unit_options(VM& vm, Depreca } } } else { - style = style_value.as_string().string(); + style = style_value.as_string().deprecated_string(); } // 4. Let displayField be the string-concatenation of unit and "Display". @@ -296,7 +296,7 @@ ThrowCompletionOr<DurationUnitOptions> get_duration_unit_options(VM& vm, Depreca } // 7. Return the Record { [[Style]]: style, [[Display]]: display }. - return DurationUnitOptions { .style = move(style), .display = display.as_string().string() }; + return DurationUnitOptions { .style = move(style), .display = display.as_string().deprecated_string() }; } // 1.1.7 PartitionDurationFormatPattern ( durationFormat, duration ), https://tc39.es/proposal-intl-duration-format/#sec-partitiondurationformatpattern diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatConstructor.cpp index 02459a4c6f..d86535bf5a 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatConstructor.cpp @@ -67,14 +67,14 @@ ThrowCompletionOr<Object*> DurationFormatConstructor::construct(FunctionObject& // 7. If numberingSystem is not undefined, then if (!numbering_system.is_undefined()) { // a. If numberingSystem does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception. - if (!::Locale::is_type_identifier(numbering_system.as_string().string())) + if (!::Locale::is_type_identifier(numbering_system.as_string().deprecated_string())) return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, numbering_system, "numberingSystem"sv); } // 8. Let opt be the Record { [[localeMatcher]]: matcher, [[nu]]: numberingSystem }. LocaleOptions opt {}; opt.locale_matcher = matcher; - opt.nu = numbering_system.is_undefined() ? Optional<DeprecatedString>() : numbering_system.as_string().string(); + opt.nu = numbering_system.is_undefined() ? Optional<DeprecatedString>() : numbering_system.as_string().deprecated_string(); // 9. Let r be ResolveLocale(%DurationFormat%.[[AvailableLocales]], requestedLocales, opt, %DurationFormat%.[[RelevantExtensionKeys]], %DurationFormat%.[[LocaleData]]). auto result = resolve_locale(requested_locales, opt, DurationFormat::relevant_extension_keys()); @@ -93,7 +93,7 @@ ThrowCompletionOr<Object*> DurationFormatConstructor::construct(FunctionObject& auto style = TRY(get_option(vm, *options, vm.names.style, OptionType::String, { "long"sv, "short"sv, "narrow"sv, "digital"sv }, "short"sv)); // 14. Set durationFormat.[[Style]] to style. - duration_format->set_style(style.as_string().string()); + duration_format->set_style(style.as_string().deprecated_string()); // 15. Set durationFormat.[[DataLocale]] to r.[[dataLocale]]. duration_format->set_data_locale(move(result.data_locale)); @@ -119,7 +119,7 @@ ThrowCompletionOr<Object*> DurationFormatConstructor::construct(FunctionObject& auto digital_base = duration_instances_component.digital_default; // f. Let unitOptions be ? GetDurationUnitOptions(unit, options, style, valueList, digitalBase, prevStyle). - auto unit_options = TRY(get_duration_unit_options(vm, unit, *options, style.as_string().string(), value_list, digital_base, previous_style)); + auto unit_options = TRY(get_duration_unit_options(vm, unit, *options, style.as_string().deprecated_string(), value_list, digital_base, previous_style)); // g. Set the value of the styleSlot slot of durationFormat to unitOptions.[[Style]]. (duration_format->*style_slot)(unit_options.style); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/ListFormat.cpp b/Userland/Libraries/LibJS/Runtime/Intl/ListFormat.cpp index bad9f2e087..fed856a494 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/ListFormat.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/ListFormat.cpp @@ -274,7 +274,7 @@ ThrowCompletionOr<Vector<DeprecatedString>> string_list_from_iterable(VM& vm, Va } // iii. Append nextValue to the end of the List list. - list.append(next_value.as_string().string()); + list.append(next_value.as_string().deprecated_string()); } } while (next != nullptr); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.cpp index 0e6246d054..9214693169 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.cpp @@ -80,13 +80,13 @@ ThrowCompletionOr<Object*> ListFormatConstructor::construct(FunctionObject& new_ auto type = TRY(get_option(vm, *options, vm.names.type, OptionType::String, { "conjunction"sv, "disjunction"sv, "unit"sv }, "conjunction"sv)); // 12. Set listFormat.[[Type]] to type. - list_format->set_type(type.as_string().string()); + list_format->set_type(type.as_string().deprecated_string()); // 13. Let style be ? GetOption(options, "style", "string", « "long", "short", "narrow" », "long"). auto style = TRY(get_option(vm, *options, vm.names.style, OptionType::String, { "long"sv, "short"sv, "narrow"sv }, "long"sv)); // 14. Set listFormat.[[Style]] to style. - list_format->set_style(style.as_string().string()); + list_format->set_style(style.as_string().deprecated_string()); // Note: The remaining steps are skipped in favor of deferring to LibUnicode. diff --git a/Userland/Libraries/LibJS/Runtime/Intl/Locale.cpp b/Userland/Libraries/LibJS/Runtime/Intl/Locale.cpp index a685623fcb..a63486c79b 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/Locale.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/Locale.cpp @@ -28,7 +28,7 @@ Locale::Locale(Object& prototype) Locale::Locale(::Locale::LocaleID const& locale_id, Object& prototype) : Object(prototype) { - set_locale(locale_id.to_string()); + set_locale(locale_id.to_deprecated_string()); for (auto const& extension : locale_id.extensions) { if (!extension.has<::Locale::LocaleExtension>()) diff --git a/Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp index 9b07636973..d86b9e4d23 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp @@ -33,10 +33,10 @@ static ThrowCompletionOr<Optional<DeprecatedString>> get_string_option(VM& vm, O if (option.is_undefined()) return Optional<DeprecatedString> {}; - if (validator && !validator(option.as_string().string())) + if (validator && !validator(option.as_string().deprecated_string())) return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, option, property); - return option.as_string().string(); + return option.as_string().deprecated_string(); } // 14.1.2 ApplyOptionsToTag ( tag, options ), https://tc39.es/ecma402/#sec-apply-options-to-tag @@ -198,7 +198,7 @@ static LocaleAndKeys apply_unicode_extension_to_tag(StringView tag, LocaleAndKey // 7. Let locale be the String value that is tag with any Unicode locale extension sequences removed. locale_id->remove_extension_type<::Locale::LocaleExtension>(); - auto locale = locale_id->to_string(); + auto locale = locale_id->to_deprecated_string(); // 8. Let newExtension be a Unicode BCP 47 U Extension based on attributes and keywords. ::Locale::LocaleExtension new_extension { move(attributes), move(keywords) }; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp index 9e57070227..b9d217e6b9 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp @@ -115,7 +115,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocalePrototype::base_name) VERIFY(locale.has_value()); // 4. Return the substring of locale corresponding to the unicode_language_id production. - return js_string(vm, locale->language_id.to_string()); + return js_string(vm, locale->language_id.to_deprecated_string()); } #define JS_ENUMERATE_LOCALE_KEYWORD_PROPERTIES \ diff --git a/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.cpp b/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.cpp index ab254b1c0e..8cfc51906c 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.cpp @@ -293,7 +293,7 @@ bool MathematicalValue::is_zero() const [](auto) { return false; }); } -DeprecatedString MathematicalValue::to_string() const +DeprecatedString MathematicalValue::to_deprecated_string() const { return m_value.visit( [](double value) { return number_to_string(value, NumberToStringMode::WithoutExponent); }, diff --git a/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.h b/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.h index 25436c290f..bbef224db4 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.h @@ -87,7 +87,7 @@ public: bool is_positive() const; bool is_zero() const; - DeprecatedString to_string() const; + DeprecatedString to_deprecated_string() const; Value to_value(VM&) const; private: diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormat.cpp b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormat.cpp index e66e20525a..786cfe8508 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormat.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormat.cpp @@ -960,7 +960,7 @@ static DeprecatedString cut_trailing_zeroes(StringView string, int cut) string = string.substring_view(0, string.length() - 1); } - return string.to_string(); + return string.to_deprecated_string(); } enum class PreferredResult { @@ -996,7 +996,7 @@ static auto to_raw_precision_function(MathematicalValue const& number, int preci result.number = number.divided_by_power(result.exponent - precision); // FIXME: Can we do this without string conversion? - auto digits = result.number.to_string(); + auto digits = result.number.to_deprecated_string(); auto digit = digits.substring_view(digits.length() - 1); result.number = result.number.divided_by(10); @@ -1067,7 +1067,7 @@ RawFormatResult to_raw_precision(MathematicalValue const& number, int min_precis } // f. Let m be the String consisting of the digits of the decimal representation of n (in order, with no leading zeroes). - result.formatted_string = n.to_string(); + result.formatted_string = n.to_deprecated_string(); } // 4. If e ≥ p–1, then @@ -1144,7 +1144,7 @@ static auto to_raw_fixed_function(MathematicalValue const& number, int fraction, result.number = number.multiplied_by_power(fraction - 1); // FIXME: Can we do this without string conversion? - auto digits = result.number.to_string(); + auto digits = result.number.to_deprecated_string(); auto digit = digits.substring_view(digits.length() - 1); result.number = result.number.multiplied_by(10); @@ -1206,7 +1206,7 @@ RawFormatResult to_raw_fixed(MathematicalValue const& number, int min_fraction, } // 7. If n = 0, let m be "0". Otherwise, let m be the String consisting of the digits of the decimal representation of n (in order, with no leading zeroes). - result.formatted_string = n.is_zero() ? DeprecatedString("0"sv) : n.to_string(); + result.formatted_string = n.is_zero() ? DeprecatedString("0"sv) : n.to_deprecated_string(); // 8. If f ≠ 0, then if (fraction != 0) { @@ -1592,7 +1592,7 @@ ThrowCompletionOr<MathematicalValue> to_intl_mathematical_value(VM& vm, Value va // 3. If Type(primValue) is String, // a. Let str be primValue. - auto const& string = primitive_value.as_string().string(); + auto const& string = primitive_value.as_string().deprecated_string(); // Step 4 handled separately by the FIXME above. diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.cpp index d791c4d140..269c6763ba 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.cpp @@ -103,11 +103,11 @@ ThrowCompletionOr<NumberFormat*> initialize_number_format(VM& vm, NumberFormat& // 7. If numberingSystem is not undefined, then if (!numbering_system.is_undefined()) { // a. If numberingSystem does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception. - if (!::Locale::is_type_identifier(numbering_system.as_string().string())) + if (!::Locale::is_type_identifier(numbering_system.as_string().deprecated_string())) return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, numbering_system, "numberingSystem"sv); // 8. Set opt.[[nu]] to numberingSystem. - opt.nu = numbering_system.as_string().string(); + opt.nu = numbering_system.as_string().deprecated_string(); } // 9. Let localeData be %NumberFormat%.[[LocaleData]]. @@ -176,7 +176,7 @@ ThrowCompletionOr<NumberFormat*> initialize_number_format(VM& vm, NumberFormat& auto notation = TRY(get_option(vm, *options, vm.names.notation, OptionType::String, { "standard"sv, "scientific"sv, "engineering"sv, "compact"sv }, "standard"sv)); // 22. Set numberFormat.[[Notation]] to notation. - number_format.set_notation(notation.as_string().string()); + number_format.set_notation(notation.as_string().deprecated_string()); // 23. Perform ? SetNumberFormatDigitOptions(numberFormat, options, mnfdDefault, mxfdDefault, notation). TRY(set_number_format_digit_options(vm, number_format, *options, default_min_fraction_digits, default_max_fraction_digits, number_format.notation())); @@ -199,7 +199,7 @@ ThrowCompletionOr<NumberFormat*> initialize_number_format(VM& vm, NumberFormat& auto trailing_zero_display = TRY(get_option(vm, *options, vm.names.trailingZeroDisplay, OptionType::String, { "auto"sv, "stripIfInteger"sv }, "auto"sv)); // 27. Set numberFormat.[[TrailingZeroDisplay]] to trailingZeroDisplay. - number_format.set_trailing_zero_display(trailing_zero_display.as_string().string()); + number_format.set_trailing_zero_display(trailing_zero_display.as_string().deprecated_string()); // 28. Let compactDisplay be ? GetOption(options, "compactDisplay", "string", « "short", "long" », "short"). auto compact_display = TRY(get_option(vm, *options, vm.names.compactDisplay, OptionType::String, { "short"sv, "long"sv }, "short"sv)); @@ -210,7 +210,7 @@ ThrowCompletionOr<NumberFormat*> initialize_number_format(VM& vm, NumberFormat& // 30. If notation is "compact", then if (number_format.notation() == NumberFormat::Notation::Compact) { // a. Set numberFormat.[[CompactDisplay]] to compactDisplay. - number_format.set_compact_display(compact_display.as_string().string()); + number_format.set_compact_display(compact_display.as_string().deprecated_string()); // b. Set defaultUseGrouping to "min2". default_use_grouping = "min2"sv; @@ -226,13 +226,13 @@ ThrowCompletionOr<NumberFormat*> initialize_number_format(VM& vm, NumberFormat& auto sign_display = TRY(get_option(vm, *options, vm.names.signDisplay, OptionType::String, { "auto"sv, "never"sv, "always"sv, "exceptZero"sv, "negative"sv }, "auto"sv)); // 34. Set numberFormat.[[SignDisplay]] to signDisplay. - number_format.set_sign_display(sign_display.as_string().string()); + number_format.set_sign_display(sign_display.as_string().deprecated_string()); // 35. Let roundingMode be ? GetOption(options, "roundingMode", "string", « "ceil", "floor", "expand", "trunc", "halfCeil", "halfFloor", "halfExpand", "halfTrunc", "halfEven" », "halfExpand"). auto rounding_mode = TRY(get_option(vm, *options, vm.names.roundingMode, OptionType::String, { "ceil"sv, "floor"sv, "expand"sv, "trunc"sv, "halfCeil"sv, "halfFloor"sv, "halfExpand"sv, "halfTrunc"sv, "halfEven"sv }, "halfExpand"sv)); // 36. Set numberFormat.[[RoundingMode]] to roundingMode. - number_format.set_rounding_mode(rounding_mode.as_string().string()); + number_format.set_rounding_mode(rounding_mode.as_string().deprecated_string()); // 37. Return numberFormat. return &number_format; @@ -282,7 +282,7 @@ ThrowCompletionOr<void> set_number_format_digit_options(VM& vm, NumberFormatBase bool need_fraction_digits = true; // 14. If roundingPriority is "auto", then - if (rounding_priority.as_string().string() == "auto"sv) { + if (rounding_priority.as_string().deprecated_string() == "auto"sv) { // a. Set needSd to hasSd. need_significant_digits = has_significant_digits; @@ -358,12 +358,12 @@ ThrowCompletionOr<void> set_number_format_digit_options(VM& vm, NumberFormatBase // 17. If needSd is true or needFd is true, then if (need_significant_digits || need_fraction_digits) { // a. If roundingPriority is "morePrecision", then - if (rounding_priority.as_string().string() == "morePrecision"sv) { + if (rounding_priority.as_string().deprecated_string() == "morePrecision"sv) { // i. Set intlObj.[[RoundingType]] to morePrecision. intl_object.set_rounding_type(NumberFormatBase::RoundingType::MorePrecision); } // b. Else if roundingPriority is "lessPrecision", then - else if (rounding_priority.as_string().string() == "lessPrecision"sv) { + else if (rounding_priority.as_string().deprecated_string() == "lessPrecision"sv) { // i. Set intlObj.[[RoundingType]] to lessPrecision. intl_object.set_rounding_type(NumberFormatBase::RoundingType::LessPrecision); } @@ -410,7 +410,7 @@ ThrowCompletionOr<void> set_number_format_unit_options(VM& vm, NumberFormat& int auto style = TRY(get_option(vm, options, vm.names.style, OptionType::String, { "decimal"sv, "percent"sv, "currency"sv, "unit"sv }, "decimal"sv)); // 4. Set intlObj.[[Style]] to style. - intl_object.set_style(style.as_string().string()); + intl_object.set_style(style.as_string().deprecated_string()); // 5. Let currency be ? GetOption(options, "currency", "string", undefined, undefined). auto currency = TRY(get_option(vm, options, vm.names.currency, OptionType::String, {}, Empty {})); @@ -423,7 +423,7 @@ ThrowCompletionOr<void> set_number_format_unit_options(VM& vm, NumberFormat& int } // 7. Else, // a. If ! IsWellFormedCurrencyCode(currency) is false, throw a RangeError exception. - else if (!is_well_formed_currency_code(currency.as_string().string())) + else if (!is_well_formed_currency_code(currency.as_string().deprecated_string())) return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, currency, "currency"sv); // 8. Let currencyDisplay be ? GetOption(options, "currencyDisplay", "string", « "code", "symbol", "narrowSymbol", "name" », "symbol"). @@ -443,7 +443,7 @@ ThrowCompletionOr<void> set_number_format_unit_options(VM& vm, NumberFormat& int } // 12. Else, // a. If ! IsWellFormedUnitIdentifier(unit) is false, throw a RangeError exception. - else if (!is_well_formed_unit_identifier(unit.as_string().string())) + else if (!is_well_formed_unit_identifier(unit.as_string().deprecated_string())) return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, unit, "unit"sv); // 13. Let unitDisplay be ? GetOption(options, "unitDisplay", "string", « "short", "narrow", "long" », "short"). @@ -452,22 +452,22 @@ ThrowCompletionOr<void> set_number_format_unit_options(VM& vm, NumberFormat& int // 14. If style is "currency", then if (intl_object.style() == NumberFormat::Style::Currency) { // a. Set intlObj.[[Currency]] to the ASCII-uppercase of currency. - intl_object.set_currency(currency.as_string().string().to_uppercase()); + intl_object.set_currency(currency.as_string().deprecated_string().to_uppercase()); // c. Set intlObj.[[CurrencyDisplay]] to currencyDisplay. - intl_object.set_currency_display(currency_display.as_string().string()); + intl_object.set_currency_display(currency_display.as_string().deprecated_string()); // d. Set intlObj.[[CurrencySign]] to currencySign. - intl_object.set_currency_sign(currency_sign.as_string().string()); + intl_object.set_currency_sign(currency_sign.as_string().deprecated_string()); } // 15. If style is "unit", then if (intl_object.style() == NumberFormat::Style::Unit) { // a. Set intlObj.[[Unit]] to unit. - intl_object.set_unit(unit.as_string().string()); + intl_object.set_unit(unit.as_string().deprecated_string()); // b. Set intlObj.[[UnitDisplay]] to unitDisplay. - intl_object.set_unit_display(unit_display.as_string().string()); + intl_object.set_unit_display(unit_display.as_string().deprecated_string()); } return {}; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.cpp index 3b598ff3f2..8585aca319 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.cpp @@ -94,7 +94,7 @@ ThrowCompletionOr<PluralRules*> initialize_plural_rules(VM& vm, PluralRules& plu auto type = TRY(get_option(vm, *options, vm.names.type, OptionType::String, AK::Array { "cardinal"sv, "ordinal"sv }, "cardinal"sv)); // 7. Set pluralRules.[[Type]] to t. - plural_rules.set_type(type.as_string().string()); + plural_rules.set_type(type.as_string().deprecated_string()); // 8. Perform ? SetNumberFormatDigitOptions(pluralRules, options, +0𝔽, 3𝔽, "standard"). TRY(set_number_format_digit_options(vm, plural_rules, *options, 0, 3, NumberFormat::Notation::Standard)); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormat.cpp b/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormat.cpp index f8184567c1..248782ebde 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormat.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormat.cpp @@ -148,7 +148,7 @@ ThrowCompletionOr<Vector<PatternPartitionWithUnit>> partition_relative_time_patt VERIFY(patterns.size() == 1); // i. Let result be patterns.[[<valueString>]]. - auto result = patterns[0].pattern.to_string(); + auto result = patterns[0].pattern.to_deprecated_string(); // ii. Return a List containing the Record { [[Type]]: "literal", [[Value]]: result }. return Vector<PatternPartitionWithUnit> { { "literal"sv, move(result) } }; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatConstructor.cpp index c3626ad4ae..8a2731b688 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatConstructor.cpp @@ -101,11 +101,11 @@ ThrowCompletionOr<RelativeTimeFormat*> initialize_relative_time_format(VM& vm, R // 7. If numberingSystem is not undefined, then if (!numbering_system.is_undefined()) { // a. If numberingSystem does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception. - if (!::Locale::is_type_identifier(numbering_system.as_string().string())) + if (!::Locale::is_type_identifier(numbering_system.as_string().deprecated_string())) return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, numbering_system, "numberingSystem"sv); // 8. Set opt.[[nu]] to numberingSystem. - opt.nu = numbering_system.as_string().string(); + opt.nu = numbering_system.as_string().deprecated_string(); } // 9. Let localeData be %RelativeTimeFormat%.[[LocaleData]]. @@ -129,13 +129,13 @@ ThrowCompletionOr<RelativeTimeFormat*> initialize_relative_time_format(VM& vm, R auto style = TRY(get_option(vm, *options, vm.names.style, OptionType::String, { "long"sv, "short"sv, "narrow"sv }, "long"sv)); // 16. Set relativeTimeFormat.[[Style]] to style. - relative_time_format.set_style(style.as_string().string()); + relative_time_format.set_style(style.as_string().deprecated_string()); // 17. Let numeric be ? GetOption(options, "numeric", "string", « "always", "auto" », "always"). auto numeric = TRY(get_option(vm, *options, vm.names.numeric, OptionType::String, { "always"sv, "auto"sv }, "always"sv)); // 18. Set relativeTimeFormat.[[Numeric]] to numeric. - relative_time_format.set_numeric(numeric.as_string().string()); + relative_time_format.set_numeric(numeric.as_string().deprecated_string()); // 19. Let relativeTimeFormat.[[NumberFormat]] be ! Construct(%NumberFormat%, « locale »). auto* number_format = MUST(construct(vm, *realm.intrinsics().intl_number_format_constructor(), js_string(vm, locale))); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/SegmenterConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/SegmenterConstructor.cpp index e38c0ba472..8c9583987d 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/SegmenterConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/SegmenterConstructor.cpp @@ -80,7 +80,7 @@ ThrowCompletionOr<Object*> SegmenterConstructor::construct(FunctionObject& new_t auto granularity = TRY(get_option(vm, *options, vm.names.granularity, OptionType::String, { "grapheme"sv, "word"sv, "sentence"sv }, "grapheme"sv)); // 13. Set segmenter.[[SegmenterGranularity]] to granularity. - segmenter->set_segmenter_granularity(granularity.as_string().string()); + segmenter->set_segmenter_granularity(granularity.as_string().deprecated_string()); // 14. Return segmenter. return segmenter; |