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

LibJS+LibWeb: Rename number_to_string to number_to_deprecated_string

This commit is contained in:
Timothy Flynn 2023-01-13 11:43:01 -05:00 committed by Linus Groh
parent c79d20be58
commit 8a88d4434f
5 changed files with 8 additions and 8 deletions

View file

@ -296,7 +296,7 @@ bool MathematicalValue::is_zero() const
DeprecatedString MathematicalValue::to_deprecated_string() const
{
return m_value.visit(
[](double value) { return number_to_string(value, NumberToStringMode::WithoutExponent); },
[](double value) { return number_to_deprecated_string(value, NumberToStringMode::WithoutExponent); },
[](Crypto::SignedBigInteger const& value) { return value.to_base_deprecated(10); },
[](auto) -> DeprecatedString { VERIFY_NOT_REACHED(); });
}

View file

@ -145,7 +145,7 @@ JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_exponential)
number = round(number / pow(10, exponent - fraction_digits));
// c. Let m be the String value consisting of the digits of the decimal representation of n (in order, with no leading zeroes).
number_string = number_to_string(number, NumberToStringMode::WithoutExponent);
number_string = number_to_deprecated_string(number, NumberToStringMode::WithoutExponent);
}
// 11. If f ≠ 0, then
@ -349,7 +349,7 @@ JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_precision)
number = round(number / pow(10, exponent - precision + 1));
// b. Let m be the String value consisting of the digits of the decimal representation of n (in order, with no leading zeroes).
number_string = number_to_string(number, NumberToStringMode::WithoutExponent);
number_string = number_to_deprecated_string(number, NumberToStringMode::WithoutExponent);
// c. If e < -6 or e ≥ p, then
if ((exponent < -6) || (exponent >= precision)) {

View file

@ -72,7 +72,7 @@ ALWAYS_INLINE bool both_bigint(Value const& lhs, Value const& rhs)
// 6.1.6.1.20 Number::toString ( x ), https://tc39.es/ecma262/#sec-numeric-types-number-tostring
// Implementation for radix = 10
DeprecatedString number_to_string(double d, NumberToStringMode mode)
DeprecatedString number_to_deprecated_string(double d, NumberToStringMode mode)
{
auto convert_to_decimal_digits_array = [](auto x, auto& digits, auto& length) {
for (; x; x /= 10)
@ -339,7 +339,7 @@ DeprecatedString Value::typeof() const
DeprecatedString Value::to_string_without_side_effects() const
{
if (is_double())
return number_to_string(m_value.as_double);
return number_to_deprecated_string(m_value.as_double);
switch (m_value.tag) {
case UNDEFINED_TAG:
@ -377,7 +377,7 @@ ThrowCompletionOr<PrimitiveString*> Value::to_primitive_string(VM& vm)
ThrowCompletionOr<DeprecatedString> Value::to_string(VM& vm) const
{
if (is_double())
return number_to_string(m_value.as_double);
return number_to_deprecated_string(m_value.as_double);
switch (m_value.tag) {
// 1. If argument is a String, return argument.

View file

@ -566,7 +566,7 @@ enum class NumberToStringMode {
WithExponent,
WithoutExponent,
};
DeprecatedString number_to_string(double, NumberToStringMode = NumberToStringMode::WithExponent);
DeprecatedString number_to_deprecated_string(double, NumberToStringMode = NumberToStringMode::WithExponent);
Optional<Value> string_to_number(StringView);
inline bool Value::operator==(Value const& value) const { return same_value(*this, value); }