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

LibJS: Rename ToIntegerThrowOnInfinity to ToIntegerWithTruncation

This commit ticks away two of the boxes in #15525
Temporal commits: tc39/proposal-temporal@f274678 and
tc39/proposal-temporal@a63a0fb
This commit is contained in:
BodilessSleeper 2023-01-06 03:31:29 +01:00 committed by Linus Groh
parent 18122c0368
commit 90b43712e6
8 changed files with 70 additions and 68 deletions

View file

@ -48,23 +48,23 @@ ThrowCompletionOr<NonnullGCPtr<Object>> PlainTimeConstructor::construct(Function
{
auto& vm = this->vm();
// 2. Let hour be ? ToIntegerThrowOnInfinity(hour).
auto hour = TRY(to_integer_throw_on_infinity(vm, vm.argument(0), ErrorType::TemporalInvalidPlainTime));
// 2. Let hour be ? ToIntegerWithTruncation(hour).
auto hour = TRY(to_integer_with_truncation(vm, vm.argument(0), ErrorType::TemporalInvalidPlainTime));
// 3. Let minute be ? ToIntegerThrowOnInfinity(hour).
auto minute = TRY(to_integer_throw_on_infinity(vm, vm.argument(1), ErrorType::TemporalInvalidPlainTime));
// 3. Let minute be ? ToIntegerWithTruncation(hour).
auto minute = TRY(to_integer_with_truncation(vm, vm.argument(1), ErrorType::TemporalInvalidPlainTime));
// 4. Let second be ? ToIntegerThrowOnInfinity(hour).
auto second = TRY(to_integer_throw_on_infinity(vm, vm.argument(2), ErrorType::TemporalInvalidPlainTime));
// 4. Let second be ? ToIntegerWithTruncation(hour).
auto second = TRY(to_integer_with_truncation(vm, vm.argument(2), ErrorType::TemporalInvalidPlainTime));
// 5. Let millisecond be ? ToIntegerThrowOnInfinity(hour).
auto millisecond = TRY(to_integer_throw_on_infinity(vm, vm.argument(3), ErrorType::TemporalInvalidPlainTime));
// 5. Let millisecond be ? ToIntegerWithTruncation(hour).
auto millisecond = TRY(to_integer_with_truncation(vm, vm.argument(3), ErrorType::TemporalInvalidPlainTime));
// 6. Let microsecond be ? ToIntegerThrowOnInfinity(hour).
auto microsecond = TRY(to_integer_throw_on_infinity(vm, vm.argument(4), ErrorType::TemporalInvalidPlainTime));
// 6. Let microsecond be ? ToIntegerWithTruncation(hour).
auto microsecond = TRY(to_integer_with_truncation(vm, vm.argument(4), ErrorType::TemporalInvalidPlainTime));
// 7. Let nanosecond be ? ToIntegerThrowOnInfinity(hour).
auto nanosecond = TRY(to_integer_throw_on_infinity(vm, vm.argument(5), ErrorType::TemporalInvalidPlainTime));
// 7. Let nanosecond be ? ToIntegerWithTruncation(hour).
auto nanosecond = TRY(to_integer_with_truncation(vm, vm.argument(5), ErrorType::TemporalInvalidPlainTime));
// IMPLEMENTATION DEFINED: This is an optimization that allows us to treat these doubles as normal integers from this point onwards.
// This does not change the exposed behavior as the call to CreateTemporalTime will immediately check that these values are valid