mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:07:36 +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:
parent
18122c0368
commit
90b43712e6
8 changed files with 70 additions and 68 deletions
|
@ -209,8 +209,8 @@ ThrowCompletionOr<double> calendar_year(VM& vm, Object& calendar, Object& date_l
|
|||
if (result.is_undefined())
|
||||
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarFunctionResult, vm.names.year.as_string(), vm.names.undefined.as_string());
|
||||
|
||||
// 3. Return ? ToIntegerThrowOnInfinity(result).
|
||||
return TRY(to_integer_throw_on_infinity(vm, result, ErrorType::TemporalInvalidCalendarFunctionResult, vm.names.year.as_string(), vm.names.Infinity.as_string()));
|
||||
// 3. Return ? ToIntegerWithTruncation(result).
|
||||
return TRY(to_integer_with_truncation(vm, result, ErrorType::TemporalInvalidCalendarFunctionResult, vm.names.year.as_string(), vm.names.Infinity.as_string()));
|
||||
}
|
||||
|
||||
// 12.2.9 CalendarMonth ( calendar, dateLike ), https://tc39.es/proposal-temporal/#sec-temporal-calendarmonth
|
||||
|
@ -308,8 +308,7 @@ ThrowCompletionOr<double> calendar_year_of_week(VM& vm, Object& calendar, Object
|
|||
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarFunctionResult, vm.names.yearOfWeek.as_string(), vm.names.undefined.as_string());
|
||||
|
||||
// 3. Return ? ToIntegerWithTruncation(result).
|
||||
// FIXME: ToIntegerThrowOnInfinity was renamed to ToIntegerWithTruncation in https://github.com/tc39/proposal-temporal/commit/f2746783e808c0144f2ce669e004a8c6286f9fc7
|
||||
return TRY(to_integer_throw_on_infinity(vm, result, ErrorType::TemporalInvalidCalendarFunctionResult, vm.names.yearOfWeek.as_string(), vm.names.Infinity.to_string()));
|
||||
return TRY(to_integer_with_truncation(vm, result, ErrorType::TemporalInvalidCalendarFunctionResult, vm.names.yearOfWeek.as_string(), vm.names.Infinity.to_string()));
|
||||
}
|
||||
|
||||
// 12.2.16 CalendarDaysInWeek ( calendar, dateLike ), https://tc39.es/proposal-temporal/#sec-temporal-calendardaysinweek
|
||||
|
@ -402,9 +401,9 @@ ThrowCompletionOr<Value> calendar_era_year(VM& vm, Object& calendar, Object& dat
|
|||
// 2. Let result be ? Invoke(calendar, "eraYear", « dateLike »).
|
||||
auto result = TRY(Value(&calendar).invoke(vm, vm.names.eraYear, &date_like));
|
||||
|
||||
// 3. If result is not undefined, set result to ? ToIntegerThrowOnInfinity(result).
|
||||
// 3. If result is not undefined, set result to ? ToIntegerWithTruncation(result).
|
||||
if (!result.is_undefined())
|
||||
result = Value(TRY(to_integer_throw_on_infinity(vm, result, ErrorType::TemporalInvalidCalendarFunctionResult, vm.names.eraYear.as_string(), "Infinity"sv)));
|
||||
result = Value(TRY(to_integer_with_truncation(vm, result, ErrorType::TemporalInvalidCalendarFunctionResult, vm.names.eraYear.as_string(), "Infinity"sv)));
|
||||
|
||||
// 4. Return result.
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue