From d2ec31cbdb198e5b9a7319b639a715ceeadc0b26 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Sat, 21 Jan 2023 22:22:11 -0500 Subject: [PATCH] LibJS: Remove DeprecatedString usage from Intl.PluralRules This can make due with a StringView. --- Userland/Libraries/LibJS/Runtime/Intl/PluralRules.cpp | 2 +- Userland/Libraries/LibJS/Runtime/Intl/PluralRules.h | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/Intl/PluralRules.cpp b/Userland/Libraries/LibJS/Runtime/Intl/PluralRules.cpp index acaa93697b..a8b4328b05 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/PluralRules.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/PluralRules.cpp @@ -18,7 +18,7 @@ PluralRules::PluralRules(Object& prototype) } // 16.5.1 GetOperands ( s ), https://tc39.es/ecma402/#sec-getoperands -::Locale::PluralOperands get_operands(DeprecatedString const& string) +::Locale::PluralOperands get_operands(StringView string) { // 1.Let n be ! ToNumber(s). auto number = string.to_double(AK::TrimWhitespace::Yes).release_value(); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/PluralRules.h b/Userland/Libraries/LibJS/Runtime/Intl/PluralRules.h index 3bec8c892e..d2385e2d36 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/PluralRules.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/PluralRules.h @@ -1,12 +1,11 @@ /* - * Copyright (c) 2022, Tim Flynn + * Copyright (c) 2022-2023, Tim Flynn * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once -#include #include #include #include @@ -31,7 +30,7 @@ private: ::Locale::PluralForm m_type { ::Locale::PluralForm::Cardinal }; // [[Type]] }; -::Locale::PluralOperands get_operands(DeprecatedString const& string); +::Locale::PluralOperands get_operands(StringView string); ::Locale::PluralCategory plural_rule_select(StringView locale, ::Locale::PluralForm type, Value number, ::Locale::PluralOperands operands); ::Locale::PluralCategory resolve_plural(PluralRules const&, Value number); ::Locale::PluralCategory resolve_plural(NumberFormatBase const& number_format, ::Locale::PluralForm type, Value number);