LibJS: Remove call to ToPositiveInteger after CalendarDaysInMonth

Implements: tc39/proposal-temporal@261692a

In order to remove the call to to_positive_integer() there neeeded
to be a change of return type from ThrowCompletionOr<Value> to
ThrowCompletionOr<double>.
This is one of the changes that will come anyways with the following
commit: tc39/proposal-temporal@11aad40. :^)
This commit is contained in:
BodilessSleeper 2022-12-30 05:05:46 +01:00 committed by Andreas Kling
parent 86995be111
commit 84db0c8dbf
3 changed files with 3 additions and 6 deletions

View file

@ -343,7 +343,7 @@ ThrowCompletionOr<Value> calendar_days_in_week(VM& vm, Object& calendar, Object&
}
// 12.2.17 CalendarDaysInMonth ( calendar, dateLike ), https://tc39.es/proposal-temporal/#sec-temporal-calendardaysinmonth
ThrowCompletionOr<Value> calendar_days_in_month(VM& vm, Object& calendar, Object& date_like)
ThrowCompletionOr<double> calendar_days_in_month(VM& vm, Object& calendar, Object& date_like)
{
// 1. Assert: Type(calendar) is Object.

View file

@ -55,7 +55,7 @@ ThrowCompletionOr<Value> calendar_day_of_year(VM&, Object& calendar, Object& dat
ThrowCompletionOr<Value> calendar_week_of_year(VM&, Object& calendar, Object& date_like);
ThrowCompletionOr<Value> calendar_year_of_week(VM&, Object& calendar, Object& date_like);
ThrowCompletionOr<Value> calendar_days_in_week(VM&, Object& calendar, Object& date_like);
ThrowCompletionOr<Value> calendar_days_in_month(VM&, Object& calendar, Object& date_like);
ThrowCompletionOr<double> calendar_days_in_month(VM&, Object& calendar, Object& date_like);
ThrowCompletionOr<Value> calendar_days_in_year(VM&, Object& calendar, Object& date_like);
ThrowCompletionOr<Value> calendar_months_in_year(VM&, Object& calendar, Object& date_like);
ThrowCompletionOr<Value> calendar_in_leap_year(VM&, Object& calendar, Object& date_like);

View file

@ -324,10 +324,7 @@ ThrowCompletionOr<PlainYearMonth*> add_duration_to_or_subtract_duration_from_pla
// 9. If sign < 0, then
if (sign < 0) {
// a. Let dayFromCalendar be ? CalendarDaysInMonth(calendar, yearMonth).
auto day_from_calendar = TRY(calendar_days_in_month(vm, calendar, year_month));
// b. Let day be ? ToPositiveInteger(dayFromCalendar).
day = TRY(to_positive_integer(vm, day_from_calendar));
day = TRY(calendar_days_in_month(vm, calendar, year_month));
}
// 10. Else,
else {