mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
LibJS+LibWeb: Rename number_to_string to number_to_deprecated_string
This commit is contained in:
parent
c79d20be58
commit
8a88d4434f
5 changed files with 8 additions and 8 deletions
|
@ -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(); });
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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); }
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue