diff --git a/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.cpp b/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.cpp index 5d863f7dc5..de3a059aa5 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/MathematicalValue.cpp @@ -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(); }); } diff --git a/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp b/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp index ab2a6e652e..ff8df13077 100644 --- a/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp @@ -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)) { diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index 47662f99d8..e1e9d65654 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -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 Value::to_primitive_string(VM& vm) ThrowCompletionOr 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. diff --git a/Userland/Libraries/LibJS/Runtime/Value.h b/Userland/Libraries/LibJS/Runtime/Value.h index 501bece326..dbc03c3acb 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.h +++ b/Userland/Libraries/LibJS/Runtime/Value.h @@ -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 string_to_number(StringView); inline bool Value::operator==(Value const& value) const { return same_value(*this, value); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index ef6a08ef94..242de50fc0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -728,7 +728,7 @@ DeprecatedString HTMLInputElement::value_sanitization_algorithm(DeprecatedString // https://html.spec.whatwg.org/multipage/input.html#range-state-(type=range):value-sanitization-algorithm auto maybe_double = value.to_double(TrimWhitespace::Yes); if (!maybe_double.has_value() || !isfinite(maybe_double.value())) - return JS::number_to_string(maybe_double.value_or(0)); + return JS::number_to_deprecated_string(maybe_double.value_or(0)); } else if (type_state() == HTMLInputElement::TypeAttributeState::Color) { // https://html.spec.whatwg.org/multipage/input.html#color-state-(type=color):value-sanitization-algorithm // If the value of the element is a valid simple color, then set it to the value of the element converted to ASCII lowercase;