diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.cpp index f7e9ee35ab..394d9a00df 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.cpp @@ -161,8 +161,8 @@ ThrowCompletionOr to_duration_record(VM& vm, Value inp // i. Set any to true. any = true; - // ii. Set value to ? ToIntegerWithoutRounding(value). - auto value_number = TRY(Temporal::to_integer_without_rounding(vm, value, ErrorType::TemporalInvalidDurationPropertyValueNonIntegral, unit, value)); + // ii. Set value to ? ToIntegerIfIntegral(value). + auto value_number = TRY(Temporal::to_integer_if_integral(vm, value, ErrorType::TemporalInvalidDurationPropertyValueNonIntegral, unit, value)); // iii. Set result.[[]] to value. result.*value_slot = value_number; diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h index 06a426a012..e9e93f4895 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h @@ -201,9 +201,9 @@ ThrowCompletionOr to_integer_throw_on_infinity(VM& vm, Value argument, E return integer; } -// 13.41 ToIntegerWithoutRounding ( argument ), https://tc39.es/proposal-temporal/#sec-temporal-tointegerwithoutrounding +// 13.41 ToIntegerIfIntegral ( argument ), https://tc39.es/proposal-temporal/#sec-tointegerifintegral template -ThrowCompletionOr to_integer_without_rounding(VM& vm, Value argument, ErrorType error_type, Args... args) +ThrowCompletionOr to_integer_if_integral(VM& vm, Value argument, ErrorType error_type, Args... args) { // 1. Let number be ? ToNumber(argument). auto number = TRY(argument.to_number(vm)); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp index 788ec99c6b..6df7d303ef 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp @@ -50,35 +50,35 @@ ThrowCompletionOr DurationConstructor::construct(FunctionObject& new_ta { auto& vm = this->vm(); - // 2. Let y be ? ToIntegerWithoutRounding(years). - auto y = TRY(to_integer_without_rounding(vm, vm.argument(0), ErrorType::TemporalInvalidDuration)); + // 2. Let y be ? ToIntegerIfIntegral(years). + auto y = TRY(to_integer_if_integral(vm, vm.argument(0), ErrorType::TemporalInvalidDuration)); - // 3. Let mo be ? ToIntegerWithoutRounding(months). - auto mo = TRY(to_integer_without_rounding(vm, vm.argument(1), ErrorType::TemporalInvalidDuration)); + // 3. Let mo be ? ToIntegerIfIntegral(months). + auto mo = TRY(to_integer_if_integral(vm, vm.argument(1), ErrorType::TemporalInvalidDuration)); - // 4. Let w be ? ToIntegerWithoutRounding(weeks). - auto w = TRY(to_integer_without_rounding(vm, vm.argument(2), ErrorType::TemporalInvalidDuration)); + // 4. Let w be ? ToIntegerIfIntegral(weeks). + auto w = TRY(to_integer_if_integral(vm, vm.argument(2), ErrorType::TemporalInvalidDuration)); - // 5. Let d be ? ToIntegerWithoutRounding(days). - auto d = TRY(to_integer_without_rounding(vm, vm.argument(3), ErrorType::TemporalInvalidDuration)); + // 5. Let d be ? ToIntegerIfIntegral(days). + auto d = TRY(to_integer_if_integral(vm, vm.argument(3), ErrorType::TemporalInvalidDuration)); - // 6. Let h be ? ToIntegerWithoutRounding(hours). - auto h = TRY(to_integer_without_rounding(vm, vm.argument(4), ErrorType::TemporalInvalidDuration)); + // 6. Let h be ? ToIntegerIfIntegral(hours). + auto h = TRY(to_integer_if_integral(vm, vm.argument(4), ErrorType::TemporalInvalidDuration)); - // 7. Let m be ? ToIntegerWithoutRounding(minutes). - auto m = TRY(to_integer_without_rounding(vm, vm.argument(5), ErrorType::TemporalInvalidDuration)); + // 7. Let m be ? ToIntegerIfIntegral(minutes). + auto m = TRY(to_integer_if_integral(vm, vm.argument(5), ErrorType::TemporalInvalidDuration)); - // 8. Let s be ? ToIntegerWithoutRounding(seconds). - auto s = TRY(to_integer_without_rounding(vm, vm.argument(6), ErrorType::TemporalInvalidDuration)); + // 8. Let s be ? ToIntegerIfIntegral(seconds). + auto s = TRY(to_integer_if_integral(vm, vm.argument(6), ErrorType::TemporalInvalidDuration)); - // 9. Let ms be ? ToIntegerWithoutRounding(milliseconds). - auto ms = TRY(to_integer_without_rounding(vm, vm.argument(7), ErrorType::TemporalInvalidDuration)); + // 9. Let ms be ? ToIntegerIfIntegral(milliseconds). + auto ms = TRY(to_integer_if_integral(vm, vm.argument(7), ErrorType::TemporalInvalidDuration)); - // 10. Let mis be ? ToIntegerWithoutRounding(microseconds). - auto mis = TRY(to_integer_without_rounding(vm, vm.argument(8), ErrorType::TemporalInvalidDuration)); + // 10. Let mis be ? ToIntegerIfIntegral(microseconds). + auto mis = TRY(to_integer_if_integral(vm, vm.argument(8), ErrorType::TemporalInvalidDuration)); - // 11. Let ns be ? ToIntegerWithoutRounding(nanoseconds). - auto ns = TRY(to_integer_without_rounding(vm, vm.argument(9), ErrorType::TemporalInvalidDuration)); + // 11. Let ns be ? ToIntegerIfIntegral(nanoseconds). + auto ns = TRY(to_integer_if_integral(vm, vm.argument(9), ErrorType::TemporalInvalidDuration)); // 12. Return ? CreateTemporalDuration(y, mo, w, d, h, m, s, ms, mis, ns, NewTarget). return TRY(create_temporal_duration(vm, y, mo, w, d, h, m, s, ms, mis, ns, &new_target));