mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:27:45 +00:00
LibJS: Remove DeprecatedString usage from Intl.PluralRules
This can make due with a StringView.
This commit is contained in:
parent
e45434c0c7
commit
d2ec31cbdb
2 changed files with 3 additions and 4 deletions
|
@ -18,7 +18,7 @@ PluralRules::PluralRules(Object& prototype)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 16.5.1 GetOperands ( s ), https://tc39.es/ecma402/#sec-getoperands
|
// 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).
|
// 1.Let n be ! ToNumber(s).
|
||||||
auto number = string.to_double(AK::TrimWhitespace::Yes).release_value();
|
auto number = string.to_double(AK::TrimWhitespace::Yes).release_value();
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org>
|
* Copyright (c) 2022-2023, Tim Flynn <trflynn89@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/DeprecatedString.h>
|
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
#include <LibJS/Runtime/Completion.h>
|
#include <LibJS/Runtime/Completion.h>
|
||||||
#include <LibJS/Runtime/Intl/NumberFormat.h>
|
#include <LibJS/Runtime/Intl/NumberFormat.h>
|
||||||
|
@ -31,7 +30,7 @@ private:
|
||||||
::Locale::PluralForm m_type { ::Locale::PluralForm::Cardinal }; // [[Type]]
|
::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 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(PluralRules const&, Value number);
|
||||||
::Locale::PluralCategory resolve_plural(NumberFormatBase const& number_format, ::Locale::PluralForm type, Value number);
|
::Locale::PluralCategory resolve_plural(NumberFormatBase const& number_format, ::Locale::PluralForm type, Value number);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue