mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:27:35 +00:00
LibCrypto+Everywhere: Rename *BigInteger::to_base to to_base_deprecated
This commit is contained in:
parent
63c814fa2f
commit
0ddc2e1f50
17 changed files with 24 additions and 24 deletions
|
@ -21,7 +21,7 @@ public:
|
|||
virtual ~BigInt() override = default;
|
||||
|
||||
Crypto::SignedBigInteger const& big_integer() const { return m_big_integer; }
|
||||
const DeprecatedString to_deprecated_string() const { return DeprecatedString::formatted("{}n", m_big_integer.to_base(10)); }
|
||||
const DeprecatedString to_deprecated_string() const { return DeprecatedString::formatted("{}n", m_big_integer.to_base_deprecated(10)); }
|
||||
|
||||
private:
|
||||
explicit BigInt(Crypto::SignedBigInteger);
|
||||
|
|
|
@ -55,7 +55,7 @@ JS_DEFINE_NATIVE_FUNCTION(BigIntPrototype::to_string)
|
|||
if (radix < 2 || radix > 36)
|
||||
return vm.throw_completion<RangeError>(ErrorType::InvalidRadix);
|
||||
}
|
||||
return PrimitiveString::create(vm, bigint->big_integer().to_base(radix));
|
||||
return PrimitiveString::create(vm, bigint->big_integer().to_base_deprecated(radix));
|
||||
}
|
||||
|
||||
// 21.2.3.2 BigInt.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ), https://tc39.es/ecma262/#sec-bigint.prototype.tolocalestring
|
||||
|
|
|
@ -305,7 +305,7 @@ static i64 clip_bigint_to_sane_time(Crypto::SignedBigInteger const& value)
|
|||
return NumericLimits<i64>::max();
|
||||
|
||||
// FIXME: Can we do this without string conversion?
|
||||
return value.to_base(10).to_int<i64>().value();
|
||||
return value.to_base_deprecated(10).to_int<i64>().value();
|
||||
}
|
||||
|
||||
// 21.4.1.8 GetNamedTimeZoneEpochNanoseconds ( timeZoneIdentifier, year, month, day, hour, minute, second, millisecond, microsecond, nanosecond ), https://tc39.es/ecma262/#sec-getnamedtimezoneepochnanoseconds
|
||||
|
|
|
@ -237,7 +237,7 @@ int MathematicalValue::logarithmic_floor() const
|
|||
},
|
||||
[](Crypto::SignedBigInteger const& value) {
|
||||
// FIXME: Can we do this without string conversion?
|
||||
return static_cast<int>(value.to_base(10).length() - 1);
|
||||
return static_cast<int>(value.to_base_deprecated(10).length() - 1);
|
||||
},
|
||||
[](auto) -> int { VERIFY_NOT_REACHED(); });
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ DeprecatedString MathematicalValue::to_deprecated_string() const
|
|||
{
|
||||
return m_value.visit(
|
||||
[](double value) { return number_to_string(value, NumberToStringMode::WithoutExponent); },
|
||||
[](Crypto::SignedBigInteger const& value) { return value.to_base(10); },
|
||||
[](Crypto::SignedBigInteger const& value) { return value.to_base_deprecated(10); },
|
||||
[](auto) -> DeprecatedString { VERIFY_NOT_REACHED(); });
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::epoch_seconds_getter)
|
|||
auto [s, _] = ns.big_integer().divided_by(Crypto::UnsignedBigInteger { 1'000'000'000 });
|
||||
|
||||
// 5. Return 𝔽(s).
|
||||
return Value((double)s.to_base(10).to_int<i64>().value());
|
||||
return Value((double)s.to_base_deprecated(10).to_int<i64>().value());
|
||||
}
|
||||
|
||||
// 8.3.4 get Temporal.Instant.prototype.epochMilliseconds, https://tc39.es/proposal-temporal/#sec-get-temporal.instant.prototype.epochmilliseconds
|
||||
|
@ -84,7 +84,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::epoch_milliseconds_getter)
|
|||
auto [ms, _] = ns.big_integer().divided_by(Crypto::UnsignedBigInteger { 1'000'000 });
|
||||
|
||||
// 5. Return 𝔽(ms).
|
||||
return Value((double)ms.to_base(10).to_int<i64>().value());
|
||||
return Value((double)ms.to_base_deprecated(10).to_int<i64>().value());
|
||||
}
|
||||
|
||||
// 8.3.5 get Temporal.Instant.prototype.epochMicroseconds, https://tc39.es/proposal-temporal/#sec-get-temporal.instant.prototype.epochmicroseconds
|
||||
|
|
|
@ -358,7 +358,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::epoch_seconds_getter)
|
|||
auto s = ns.big_integer().divided_by(Crypto::UnsignedBigInteger { 1'000'000'000 }).quotient;
|
||||
|
||||
// 5. Return 𝔽(s).
|
||||
return Value((double)s.to_base(10).to_int<i64>().value());
|
||||
return Value((double)s.to_base_deprecated(10).to_int<i64>().value());
|
||||
}
|
||||
|
||||
// 6.3.16 get Temporal.ZonedDateTime.prototype.epochMilliseconds, https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.epochmilliseconds
|
||||
|
@ -375,7 +375,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::epoch_milliseconds_getter)
|
|||
auto ms = ns.big_integer().divided_by(Crypto::UnsignedBigInteger { 1'000'000 }).quotient;
|
||||
|
||||
// 5. Return 𝔽(ms).
|
||||
return Value((double)ms.to_base(10).to_int<i64>().value());
|
||||
return Value((double)ms.to_base_deprecated(10).to_int<i64>().value());
|
||||
}
|
||||
|
||||
// 6.3.17 get Temporal.ZonedDateTime.prototype.epochMicroseconds, https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.epochmicroseconds
|
||||
|
|
|
@ -401,7 +401,7 @@ ThrowCompletionOr<DeprecatedString> Value::to_string(VM& vm) const
|
|||
return DeprecatedString::number(as_i32());
|
||||
// 8. If argument is a BigInt, return BigInt::toString(argument, 10).
|
||||
case BIGINT_TAG:
|
||||
return as_bigint().big_integer().to_base(10);
|
||||
return as_bigint().big_integer().to_base_deprecated(10);
|
||||
// 9. Assert: argument is an Object.
|
||||
case OBJECT_TAG: {
|
||||
// 10. Let primValue be ? ToPrimitive(argument, string).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue