1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:07:45 +00:00

LibJS: Convert calendar operation results to floats

This commit ticks away one of the boxes in #15525
Temporal commit:  tc39/proposal-temporal@11aad40
This commit is contained in:
BodilessSleeper 2023-01-05 03:32:04 +01:00 committed by Linus Groh
parent c25bef59aa
commit 8e6920a18d
6 changed files with 67 additions and 67 deletions

View file

@ -256,7 +256,7 @@ ThrowCompletionOr<double> calendar_day(VM& vm, Object& calendar, Object& date_li
} }
// 12.2.12 CalendarDayOfWeek ( calendar, dateLike ), https://tc39.es/proposal-temporal/#sec-temporal-calendardayofweek // 12.2.12 CalendarDayOfWeek ( calendar, dateLike ), https://tc39.es/proposal-temporal/#sec-temporal-calendardayofweek
ThrowCompletionOr<Value> calendar_day_of_week(VM& vm, Object& calendar, Object& date_like) ThrowCompletionOr<double> calendar_day_of_week(VM& vm, Object& calendar, Object& date_like)
{ {
// 1. Let result be ? Invoke(calendar, "dayOfWeek", « dateLike »). // 1. Let result be ? Invoke(calendar, "dayOfWeek", « dateLike »).
auto result = TRY(Value(&calendar).invoke(vm, vm.names.dayOfWeek, &date_like)); auto result = TRY(Value(&calendar).invoke(vm, vm.names.dayOfWeek, &date_like));
@ -270,7 +270,7 @@ ThrowCompletionOr<Value> calendar_day_of_week(VM& vm, Object& calendar, Object&
} }
// 12.2.13 CalendarDayOfYear ( calendar, dateLike ), https://tc39.es/proposal-temporal/#sec-temporal-calendardayofyear // 12.2.13 CalendarDayOfYear ( calendar, dateLike ), https://tc39.es/proposal-temporal/#sec-temporal-calendardayofyear
ThrowCompletionOr<Value> calendar_day_of_year(VM& vm, Object& calendar, Object& date_like) ThrowCompletionOr<double> calendar_day_of_year(VM& vm, Object& calendar, Object& date_like)
{ {
// 1. Let result be ? Invoke(calendar, "dayOfYear", « dateLike »). // 1. Let result be ? Invoke(calendar, "dayOfYear", « dateLike »).
auto result = TRY(Value(&calendar).invoke(vm, vm.names.dayOfYear, &date_like)); auto result = TRY(Value(&calendar).invoke(vm, vm.names.dayOfYear, &date_like));
@ -284,7 +284,7 @@ ThrowCompletionOr<Value> calendar_day_of_year(VM& vm, Object& calendar, Object&
} }
// 12.2.14 CalendarWeekOfYear ( calendar, dateLike ), https://tc39.es/proposal-temporal/#sec-temporal-calendarweekofyear // 12.2.14 CalendarWeekOfYear ( calendar, dateLike ), https://tc39.es/proposal-temporal/#sec-temporal-calendarweekofyear
ThrowCompletionOr<Value> calendar_week_of_year(VM& vm, Object& calendar, Object& date_like) ThrowCompletionOr<double> calendar_week_of_year(VM& vm, Object& calendar, Object& date_like)
{ {
// 1. Let result be ? Invoke(calendar, "weekOfYear", « dateLike »). // 1. Let result be ? Invoke(calendar, "weekOfYear", « dateLike »).
auto result = TRY(Value(&calendar).invoke(vm, vm.names.weekOfYear, &date_like)); auto result = TRY(Value(&calendar).invoke(vm, vm.names.weekOfYear, &date_like));
@ -298,7 +298,7 @@ ThrowCompletionOr<Value> calendar_week_of_year(VM& vm, Object& calendar, Object&
} }
// 12.2.15 CalendarYearOfWeek ( calendar, dateLike ), https://tc39.es/proposal-temporal/#sec-temporal-calendaryearofweek // 12.2.15 CalendarYearOfWeek ( calendar, dateLike ), https://tc39.es/proposal-temporal/#sec-temporal-calendaryearofweek
ThrowCompletionOr<Value> calendar_year_of_week(VM& vm, Object& calendar, Object& date_like) ThrowCompletionOr<double> calendar_year_of_week(VM& vm, Object& calendar, Object& date_like)
{ {
// 1. Let result be ? Invoke(calendar, "yearOfWeek", « dateLike »). // 1. Let result be ? Invoke(calendar, "yearOfWeek", « dateLike »).
auto result = TRY(Value(&calendar).invoke(vm, vm.names.yearOfWeek, &date_like)); auto result = TRY(Value(&calendar).invoke(vm, vm.names.yearOfWeek, &date_like));
@ -313,7 +313,7 @@ ThrowCompletionOr<Value> calendar_year_of_week(VM& vm, Object& calendar, Object&
} }
// 12.2.16 CalendarDaysInWeek ( calendar, dateLike ), https://tc39.es/proposal-temporal/#sec-temporal-calendardaysinweek // 12.2.16 CalendarDaysInWeek ( calendar, dateLike ), https://tc39.es/proposal-temporal/#sec-temporal-calendardaysinweek
ThrowCompletionOr<Value> calendar_days_in_week(VM& vm, Object& calendar, Object& date_like) ThrowCompletionOr<double> calendar_days_in_week(VM& vm, Object& calendar, Object& date_like)
{ {
// 1. Let result be ? Invoke(calendar, "daysInWeek", « dateLike »). // 1. Let result be ? Invoke(calendar, "daysInWeek", « dateLike »).
auto result = TRY(Value(&calendar).invoke(vm, vm.names.daysInWeek, &date_like)); auto result = TRY(Value(&calendar).invoke(vm, vm.names.daysInWeek, &date_like));
@ -341,7 +341,7 @@ ThrowCompletionOr<double> calendar_days_in_month(VM& vm, Object& calendar, Objec
} }
// 12.2.18 CalendarDaysInYear ( calendar, dateLike ), https://tc39.es/proposal-temporal/#sec-temporal-calendardaysinyear // 12.2.18 CalendarDaysInYear ( calendar, dateLike ), https://tc39.es/proposal-temporal/#sec-temporal-calendardaysinyear
ThrowCompletionOr<Value> calendar_days_in_year(VM& vm, Object& calendar, Object& date_like) ThrowCompletionOr<double> calendar_days_in_year(VM& vm, Object& calendar, Object& date_like)
{ {
// 1. Let result be ? Invoke(calendar, "daysInYear", « dateLike »). // 1. Let result be ? Invoke(calendar, "daysInYear", « dateLike »).
auto result = TRY(Value(&calendar).invoke(vm, vm.names.daysInYear, &date_like)); auto result = TRY(Value(&calendar).invoke(vm, vm.names.daysInYear, &date_like));
@ -355,7 +355,7 @@ ThrowCompletionOr<Value> calendar_days_in_year(VM& vm, Object& calendar, Object&
} }
// 12.2.19 CalendarMonthsInYear ( calendar, dateLike ), https://tc39.es/proposal-temporal/#sec-temporal-calendarmonthsinyear // 12.2.19 CalendarMonthsInYear ( calendar, dateLike ), https://tc39.es/proposal-temporal/#sec-temporal-calendarmonthsinyear
ThrowCompletionOr<Value> calendar_months_in_year(VM& vm, Object& calendar, Object& date_like) ThrowCompletionOr<double> calendar_months_in_year(VM& vm, Object& calendar, Object& date_like)
{ {
// 1. Let result be ? Invoke(calendar, "monthsInYear", « dateLike »). // 1. Let result be ? Invoke(calendar, "monthsInYear", « dateLike »).
auto result = TRY(Value(&calendar).invoke(vm, vm.names.monthsInYear, &date_like)); auto result = TRY(Value(&calendar).invoke(vm, vm.names.monthsInYear, &date_like));

View file

@ -50,14 +50,14 @@ ThrowCompletionOr<double> calendar_year(VM&, Object& calendar, Object& date_like
ThrowCompletionOr<double> calendar_month(VM&, Object& calendar, Object& date_like); ThrowCompletionOr<double> calendar_month(VM&, Object& calendar, Object& date_like);
ThrowCompletionOr<DeprecatedString> calendar_month_code(VM&, Object& calendar, Object& date_like); ThrowCompletionOr<DeprecatedString> calendar_month_code(VM&, Object& calendar, Object& date_like);
ThrowCompletionOr<double> calendar_day(VM&, Object& calendar, Object& date_like); ThrowCompletionOr<double> calendar_day(VM&, Object& calendar, Object& date_like);
ThrowCompletionOr<Value> calendar_day_of_week(VM&, Object& calendar, Object& date_like); ThrowCompletionOr<double> calendar_day_of_week(VM&, Object& calendar, Object& date_like);
ThrowCompletionOr<Value> calendar_day_of_year(VM&, Object& calendar, Object& date_like); ThrowCompletionOr<double> calendar_day_of_year(VM&, Object& calendar, Object& date_like);
ThrowCompletionOr<Value> calendar_week_of_year(VM&, Object& calendar, Object& date_like); ThrowCompletionOr<double> calendar_week_of_year(VM&, Object& calendar, Object& date_like);
ThrowCompletionOr<Value> calendar_year_of_week(VM&, Object& calendar, Object& date_like); ThrowCompletionOr<double> calendar_year_of_week(VM&, Object& calendar, Object& date_like);
ThrowCompletionOr<Value> calendar_days_in_week(VM&, Object& calendar, Object& date_like); ThrowCompletionOr<double> calendar_days_in_week(VM&, Object& calendar, Object& date_like);
ThrowCompletionOr<double> 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<double> calendar_days_in_year(VM&, Object& calendar, Object& date_like);
ThrowCompletionOr<Value> calendar_months_in_year(VM&, Object& calendar, Object& date_like); ThrowCompletionOr<double> calendar_months_in_year(VM&, Object& calendar, Object& date_like);
ThrowCompletionOr<Value> calendar_in_leap_year(VM&, Object& calendar, Object& date_like); ThrowCompletionOr<Value> calendar_in_leap_year(VM&, Object& calendar, Object& date_like);
ThrowCompletionOr<Value> calendar_era(VM&, Object& calendar, Object& date_like); ThrowCompletionOr<Value> calendar_era(VM&, Object& calendar, Object& date_like);
ThrowCompletionOr<Value> calendar_era_year(VM&, Object& calendar, Object& date_like); ThrowCompletionOr<Value> calendar_era_year(VM&, Object& calendar, Object& date_like);

View file

@ -91,8 +91,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::year_getter)
// 3. Let calendar be temporalDate.[[Calendar]]. // 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar(); auto& calendar = temporal_date->calendar();
// 4. Return ? CalendarYear(calendar, temporalDate). // 4. Return 𝔽(? CalendarYear(calendar, temporalDate)).
return Value(TRY(calendar_year(vm, calendar, *temporal_date))); return TRY(calendar_year(vm, calendar, *temporal_date));
} }
// 3.3.5 get Temporal.PlainDate.prototype.month, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.month // 3.3.5 get Temporal.PlainDate.prototype.month, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.month
@ -105,8 +105,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::month_getter)
// 3. Let calendar be temporalDate.[[Calendar]]. // 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar(); auto& calendar = temporal_date->calendar();
// 4. Return ? CalendarMonth(calendar, temporalDate). // 4. Return 𝔽(? CalendarMonth(calendar, temporalDate)).
return Value(TRY(calendar_month(vm, calendar, *temporal_date))); return TRY(calendar_month(vm, calendar, *temporal_date));
} }
// 3.3.6 get Temporal.PlainDate.prototype.monthCode, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.monthCode // 3.3.6 get Temporal.PlainDate.prototype.monthCode, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.monthCode
@ -133,8 +133,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::day_getter)
// 3. Let calendar be temporalDate.[[Calendar]]. // 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar(); auto& calendar = temporal_date->calendar();
// 4. Return ? CalendarDay(calendar, temporalDate). // 4. Return 𝔽(? CalendarDay(calendar, temporalDate)).
return Value(TRY(calendar_day(vm, calendar, *temporal_date))); return TRY(calendar_day(vm, calendar, *temporal_date));
} }
// 3.3.8 get Temporal.PlainDate.prototype.dayOfWeek, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.dayofweek // 3.3.8 get Temporal.PlainDate.prototype.dayOfWeek, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.dayofweek
@ -147,8 +147,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::day_of_week_getter)
// 3. Let calendar be temporalDate.[[Calendar]]. // 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar(); auto& calendar = temporal_date->calendar();
// Return ? CalendarDayOfWeek(calendar, temporalDate). // Return 𝔽(? CalendarDayOfWeek(calendar, temporalDate)).
return Value(TRY(calendar_day_of_week(vm, calendar, *temporal_date))); return TRY(calendar_day_of_week(vm, calendar, *temporal_date));
} }
// 3.3.9 get Temporal.PlainDate.prototype.dayOfYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.dayofyear // 3.3.9 get Temporal.PlainDate.prototype.dayOfYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.dayofyear
@ -161,8 +161,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::day_of_year_getter)
// 3. Let calendar be temporalDate.[[Calendar]]. // 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar(); auto& calendar = temporal_date->calendar();
// 4. Return ? CalendarDayOfYear(calendar, temporalDate). // 4. Return 𝔽(? CalendarDayOfYear(calendar, temporalDate)).
return Value(TRY(calendar_day_of_year(vm, calendar, *temporal_date))); return TRY(calendar_day_of_year(vm, calendar, *temporal_date));
} }
// 3.3.10 get Temporal.PlainDate.prototype.weekOfYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.weekofyear // 3.3.10 get Temporal.PlainDate.prototype.weekOfYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.weekofyear
@ -175,8 +175,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::week_of_year_getter)
// 3. Let calendar be temporalDate.[[Calendar]]. // 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar(); auto& calendar = temporal_date->calendar();
// 4. Return ? CalendarWeekOfYear(calendar, temporalDate). // 4. Return 𝔽(? CalendarWeekOfYear(calendar, temporalDate)).
return Value(TRY(calendar_week_of_year(vm, calendar, *temporal_date))); return TRY(calendar_week_of_year(vm, calendar, *temporal_date));
} }
// 3.3.11 get Temporal.PlainDate.prototype.yearOfWeek, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.yearofweek // 3.3.11 get Temporal.PlainDate.prototype.yearOfWeek, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.yearofweek
@ -190,7 +190,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::year_of_week_getter)
auto& calendar = temporal_date->calendar(); auto& calendar = temporal_date->calendar();
// 4. Return 𝔽(? CalendarYearOfWeek(calendar, temporalDate)). // 4. Return 𝔽(? CalendarYearOfWeek(calendar, temporalDate)).
return Value(TRY(calendar_year_of_week(vm, calendar, *temporal_date))); return TRY(calendar_year_of_week(vm, calendar, *temporal_date));
} }
// 3.3.12 get Temporal.PlainDate.prototype.daysInWeek, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.daysinweek // 3.3.12 get Temporal.PlainDate.prototype.daysInWeek, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.daysinweek
@ -203,8 +203,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::days_in_week_getter)
// 3. Let calendar be temporalDate.[[Calendar]]. // 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar(); auto& calendar = temporal_date->calendar();
// 4. Return ? CalendarDaysInWeek(calendar, temporalDate). // 4. Return 𝔽(? CalendarDaysInWeek(calendar, temporalDate)).
return Value(TRY(calendar_days_in_week(vm, calendar, *temporal_date))); return TRY(calendar_days_in_week(vm, calendar, *temporal_date));
} }
// 3.3.13 get Temporal.PlainDate.prototype.daysInMonth, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.daysinmonth // 3.3.13 get Temporal.PlainDate.prototype.daysInMonth, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.daysinmonth
@ -217,8 +217,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::days_in_month_getter)
// 3. Let calendar be temporalDate.[[Calendar]]. // 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar(); auto& calendar = temporal_date->calendar();
// 4. Return ? CalendarDaysInMonth(calendar, temporalDate). // 4. Return 𝔽(? CalendarDaysInMonth(calendar, temporalDate)).
return Value(TRY(calendar_days_in_month(vm, calendar, *temporal_date))); return TRY(calendar_days_in_month(vm, calendar, *temporal_date));
} }
// 3.3.14 get Temporal.PlainDate.prototype.daysInYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.daysinyear // 3.3.14 get Temporal.PlainDate.prototype.daysInYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.daysinyear
@ -231,8 +231,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::days_in_year_getter)
// 3. Let calendar be temporalDate.[[Calendar]]. // 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar(); auto& calendar = temporal_date->calendar();
// 4. Return ? CalendarDaysInYear(calendar, temporalDate). // 4. Return 𝔽(? CalendarDaysInYear(calendar, temporalDate)).
return Value(TRY(calendar_days_in_year(vm, calendar, *temporal_date))); return TRY(calendar_days_in_year(vm, calendar, *temporal_date));
} }
// 3.3.15 get Temporal.PlainDate.prototype.monthsInYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.monthsinyear // 3.3.15 get Temporal.PlainDate.prototype.monthsInYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.monthsinyear
@ -245,8 +245,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::months_in_year_getter)
// 3. Let calendar be temporalDate.[[Calendar]]. // 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar(); auto& calendar = temporal_date->calendar();
// 4. Return ? CalendarMonthsInYear(calendar, temporalDate). // 4. Return 𝔽(? CalendarMonthsInYear(calendar, temporalDate)).
return Value(TRY(calendar_months_in_year(vm, calendar, *temporal_date))); return TRY(calendar_months_in_year(vm, calendar, *temporal_date));
} }
// 3.3.16 get Temporal.PlainDate.prototype.inLeapYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.inleapyear // 3.3.16 get Temporal.PlainDate.prototype.inLeapYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.inleapyear

View file

@ -102,8 +102,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::year_getter)
// 3. Let calendar be dateTime.[[Calendar]]. // 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar(); auto& calendar = date_time->calendar();
// 4. Return ? CalendarYear(calendar, dateTime). // 4. Return 𝔽(? CalendarYear(calendar, dateTime)).
return Value(TRY(calendar_year(vm, calendar, *date_time))); return TRY(calendar_year(vm, calendar, *date_time));
} }
// 5.3.5 get Temporal.PlainDateTime.prototype.month, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.month // 5.3.5 get Temporal.PlainDateTime.prototype.month, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.month
@ -116,8 +116,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::month_getter)
// 3. Let calendar be dateTime.[[Calendar]]. // 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar(); auto& calendar = date_time->calendar();
// 4. Return ? CalendarMonth(calendar, dateTime). // 4. Return 𝔽(? CalendarMonth(calendar, dateTime)).
return Value(TRY(calendar_month(vm, calendar, *date_time))); return TRY(calendar_month(vm, calendar, *date_time));
} }
// 5.3.6 get Temporal.PlainDateTime.prototype.monthCode, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.monthcode // 5.3.6 get Temporal.PlainDateTime.prototype.monthCode, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.monthcode
@ -144,8 +144,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::day_getter)
// 3. Let calendar be dateTime.[[Calendar]]. // 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar(); auto& calendar = date_time->calendar();
// 4. Return ? CalendarDay(calendar, dateTime). // 4. Return 𝔽(? CalendarDay(calendar, dateTime)).
return Value(TRY(calendar_day(vm, calendar, *date_time))); return TRY(calendar_day(vm, calendar, *date_time));
} }
// 5.3.8 get Temporal.PlainDateTime.prototype.hour, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.hour // 5.3.8 get Temporal.PlainDateTime.prototype.hour, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.hour
@ -224,7 +224,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::day_of_week_getter)
// 3. Let calendar be dateTime.[[Calendar]]. // 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar(); auto& calendar = date_time->calendar();
// 4. Return ? CalendarDayOfWeek(calendar, dateTime). // 4. Return 𝔽(? CalendarDayOfWeek(calendar, dateTime)).
return TRY(calendar_day_of_week(vm, calendar, *date_time)); return TRY(calendar_day_of_week(vm, calendar, *date_time));
} }
@ -238,7 +238,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::day_of_year_getter)
// 3. Let calendar be dateTime.[[Calendar]]. // 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar(); auto& calendar = date_time->calendar();
// 4. Return ? CalendarDayOfYear(calendar, dateTime). // 4. Return 𝔽(? CalendarDayOfYear(calendar, dateTime)).
return TRY(calendar_day_of_year(vm, calendar, *date_time)); return TRY(calendar_day_of_year(vm, calendar, *date_time));
} }
@ -252,7 +252,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::week_of_year_getter)
// 3. Let calendar be dateTime.[[Calendar]]. // 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar(); auto& calendar = date_time->calendar();
// 4. Return ? CalendarWeekOfYear(calendar, dateTime). // 4. Return 𝔽(? CalendarWeekOfYear(calendar, dateTime)).
return TRY(calendar_week_of_year(vm, calendar, *date_time)); return TRY(calendar_week_of_year(vm, calendar, *date_time));
} }
@ -280,7 +280,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::days_in_week_getter)
// 3. Let calendar be dateTime.[[Calendar]]. // 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar(); auto& calendar = date_time->calendar();
// 4. Return ? CalendarDaysInWeek(calendar, dateTime). // 4. Return 𝔽(? CalendarDaysInWeek(calendar, dateTime)).
return TRY(calendar_days_in_week(vm, calendar, *date_time)); return TRY(calendar_days_in_week(vm, calendar, *date_time));
} }
@ -294,7 +294,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::days_in_month_getter)
// 3. Let calendar be dateTime.[[Calendar]]. // 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar(); auto& calendar = date_time->calendar();
// 4. Return ? CalendarDaysInMonth(calendar, dateTime). // 4. Return 𝔽(? CalendarDaysInMonth(calendar, dateTime)).
return TRY(calendar_days_in_month(vm, calendar, *date_time)); return TRY(calendar_days_in_month(vm, calendar, *date_time));
} }
@ -308,7 +308,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::days_in_year_getter)
// 3. Let calendar be dateTime.[[Calendar]]. // 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar(); auto& calendar = date_time->calendar();
// 4. Return ? CalendarDaysInYear(calendar, dateTime). // 4. Return 𝔽(? CalendarDaysInYear(calendar, dateTime)).
return TRY(calendar_days_in_year(vm, calendar, *date_time)); return TRY(calendar_days_in_year(vm, calendar, *date_time));
} }
@ -322,7 +322,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::months_in_year_getter)
// 3. Let calendar be dateTime.[[Calendar]]. // 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar(); auto& calendar = date_time->calendar();
// 4. Return ? CalendarMonthsInYear(calendar, dateTime). // 4. Return 𝔽(? CalendarMonthsInYear(calendar, dateTime)).
return TRY(calendar_months_in_year(vm, calendar, *date_time)); return TRY(calendar_months_in_year(vm, calendar, *date_time));
} }

View file

@ -120,8 +120,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::days_in_year_getter)
// 3. Let calendar be yearMonth.[[Calendar]]. // 3. Let calendar be yearMonth.[[Calendar]].
auto& calendar = year_month->calendar(); auto& calendar = year_month->calendar();
// 4. Return ? CalendarDaysInYear(calendar, yearMonth). // 4. Return 𝔽(? CalendarDaysInYear(calendar, yearMonth)).
return Value(TRY(calendar_days_in_year(vm, calendar, *year_month))); return TRY(calendar_days_in_year(vm, calendar, *year_month));
} }
// 9.3.8 get Temporal.PlainYearMonth.prototype.daysInMonth, https://tc39.es/proposal-temporal/#sec-get-temporal.plainyearmonth.prototype.daysinmonth // 9.3.8 get Temporal.PlainYearMonth.prototype.daysInMonth, https://tc39.es/proposal-temporal/#sec-get-temporal.plainyearmonth.prototype.daysinmonth
@ -134,8 +134,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::days_in_month_getter)
// 3. Let calendar be yearMonth.[[Calendar]]. // 3. Let calendar be yearMonth.[[Calendar]].
auto& calendar = year_month->calendar(); auto& calendar = year_month->calendar();
// 4. Return ? CalendarDaysInMonth(calendar, yearMonth). // 4. Return 𝔽(? CalendarDaysInMonth(calendar, yearMonth)).
return Value(TRY(calendar_days_in_month(vm, calendar, *year_month))); return TRY(calendar_days_in_month(vm, calendar, *year_month));
} }
// 9.3.9 get Temporal.PlainYearMonth.prototype.monthsInYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plainyearmonth.prototype.monthsinyear // 9.3.9 get Temporal.PlainYearMonth.prototype.monthsInYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plainyearmonth.prototype.monthsinyear
@ -148,8 +148,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::months_in_year_getter)
// 3. Let calendar be yearMonth.[[Calendar]]. // 3. Let calendar be yearMonth.[[Calendar]].
auto& calendar = year_month->calendar(); auto& calendar = year_month->calendar();
// 4. Return ? CalendarMonthsInYear(calendar, yearMonth). // 4. Return 𝔽(? CalendarMonthsInYear(calendar, yearMonth)).
return Value(TRY(calendar_months_in_year(vm, calendar, *year_month))); return TRY(calendar_months_in_year(vm, calendar, *year_month));
} }
// 9.3.10 get Temporal.PlainYearMonth.prototype.inLeapYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plainyearmonth.prototype.inleapyear // 9.3.10 get Temporal.PlainYearMonth.prototype.inLeapYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plainyearmonth.prototype.inleapyear

View file

@ -133,8 +133,8 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::year_getter)
// 6. Let temporalDateTime be ? BuiltinTimeZoneGetPlainDateTimeFor(timeZone, instant, calendar). // 6. Let temporalDateTime be ? BuiltinTimeZoneGetPlainDateTimeFor(timeZone, instant, calendar).
auto* temporal_date_time = TRY(builtin_time_zone_get_plain_date_time_for(vm, &time_zone, *instant, calendar)); auto* temporal_date_time = TRY(builtin_time_zone_get_plain_date_time_for(vm, &time_zone, *instant, calendar));
// 7. Return ? CalendarYear(calendar, temporalDateTime). // 7. Return 𝔽(? CalendarYear(calendar, temporalDateTime)).
return Value(TRY(calendar_year(vm, calendar, *temporal_date_time))); return TRY(calendar_year(vm, calendar, *temporal_date_time));
} }
// 6.3.6 get Temporal.ZonedDateTime.prototype.month, https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.month // 6.3.6 get Temporal.ZonedDateTime.prototype.month, https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.month
@ -156,8 +156,8 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::month_getter)
// 6. Let temporalDateTime be ? BuiltinTimeZoneGetPlainDateTimeFor(timeZone, instant, calendar). // 6. Let temporalDateTime be ? BuiltinTimeZoneGetPlainDateTimeFor(timeZone, instant, calendar).
auto* temporal_date_time = TRY(builtin_time_zone_get_plain_date_time_for(vm, &time_zone, *instant, calendar)); auto* temporal_date_time = TRY(builtin_time_zone_get_plain_date_time_for(vm, &time_zone, *instant, calendar));
// 7. Return ? CalendarMonth(calendar, temporalDateTime). // 7. Return 𝔽(? CalendarMonth(calendar, temporalDateTime)).
return Value(TRY(calendar_month(vm, calendar, *temporal_date_time))); return TRY(calendar_month(vm, calendar, *temporal_date_time));
} }
// 6.3.7 get Temporal.ZonedDateTime.prototype.monthCode, https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.monthcode // 6.3.7 get Temporal.ZonedDateTime.prototype.monthCode, https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.monthcode
@ -202,8 +202,8 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::day_getter)
// 6. Let temporalDateTime be ? BuiltinTimeZoneGetPlainDateTimeFor(timeZone, instant, calendar). // 6. Let temporalDateTime be ? BuiltinTimeZoneGetPlainDateTimeFor(timeZone, instant, calendar).
auto* temporal_date_time = TRY(builtin_time_zone_get_plain_date_time_for(vm, &time_zone, *instant, calendar)); auto* temporal_date_time = TRY(builtin_time_zone_get_plain_date_time_for(vm, &time_zone, *instant, calendar));
// 7. Return ? CalendarDay(calendar, temporalDateTime). // 7. Return 𝔽(? CalendarDay(calendar, temporalDateTime)).
return Value(TRY(calendar_day(vm, calendar, *temporal_date_time))); return TRY(calendar_day(vm, calendar, *temporal_date_time));
} }
// 6.3.9 get Temporal.ZonedDateTime.prototype.hour, https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.hour // 6.3.9 get Temporal.ZonedDateTime.prototype.hour, https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.hour
@ -425,7 +425,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::day_of_week_getter)
// 6. Let temporalDateTime be ? BuiltinTimeZoneGetPlainDateTimeFor(timeZone, instant, calendar). // 6. Let temporalDateTime be ? BuiltinTimeZoneGetPlainDateTimeFor(timeZone, instant, calendar).
auto* temporal_date_time = TRY(builtin_time_zone_get_plain_date_time_for(vm, &time_zone, *instant, calendar)); auto* temporal_date_time = TRY(builtin_time_zone_get_plain_date_time_for(vm, &time_zone, *instant, calendar));
// 7. Return ? CalendarDayOfWeek(calendar, temporalDateTime). // 7. Return 𝔽(? CalendarDayOfWeek(calendar, temporalDateTime)).
return TRY(calendar_day_of_week(vm, calendar, *temporal_date_time)); return TRY(calendar_day_of_week(vm, calendar, *temporal_date_time));
} }
@ -448,7 +448,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::day_of_year_getter)
// 6. Let temporalDateTime be ? BuiltinTimeZoneGetPlainDateTimeFor(timeZone, instant, calendar). // 6. Let temporalDateTime be ? BuiltinTimeZoneGetPlainDateTimeFor(timeZone, instant, calendar).
auto* temporal_date_time = TRY(builtin_time_zone_get_plain_date_time_for(vm, &time_zone, *instant, calendar)); auto* temporal_date_time = TRY(builtin_time_zone_get_plain_date_time_for(vm, &time_zone, *instant, calendar));
// 7. Return ? CalendarDayOfYear(calendar, temporalDateTime). // 7. Return 𝔽(? CalendarDayOfYear(calendar, temporalDateTime)).
return TRY(calendar_day_of_year(vm, calendar, *temporal_date_time)); return TRY(calendar_day_of_year(vm, calendar, *temporal_date_time));
} }
@ -471,7 +471,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::week_of_year_getter)
// 6. Let temporalDateTime be ? BuiltinTimeZoneGetPlainDateTimeFor(timeZone, instant, calendar). // 6. Let temporalDateTime be ? BuiltinTimeZoneGetPlainDateTimeFor(timeZone, instant, calendar).
auto* temporal_date_time = TRY(builtin_time_zone_get_plain_date_time_for(vm, &time_zone, *instant, calendar)); auto* temporal_date_time = TRY(builtin_time_zone_get_plain_date_time_for(vm, &time_zone, *instant, calendar));
// 7. Return ? CalendarWeekOfYear(calendar, temporalDateTime). // 7. Return 𝔽(? CalendarWeekOfYear(calendar, temporalDateTime)).
return TRY(calendar_week_of_year(vm, calendar, *temporal_date_time)); return TRY(calendar_week_of_year(vm, calendar, *temporal_date_time));
} }
@ -568,7 +568,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::days_in_week_getter)
// 6. Let temporalDateTime be ? BuiltinTimeZoneGetPlainDateTimeFor(timeZone, instant, calendar). // 6. Let temporalDateTime be ? BuiltinTimeZoneGetPlainDateTimeFor(timeZone, instant, calendar).
auto* temporal_date_time = TRY(builtin_time_zone_get_plain_date_time_for(vm, &time_zone, *instant, calendar)); auto* temporal_date_time = TRY(builtin_time_zone_get_plain_date_time_for(vm, &time_zone, *instant, calendar));
// 7. Return ? CalendarDaysInWeek(calendar, temporalDateTime). // 7. Return 𝔽(? CalendarDaysInWeek(calendar, temporalDateTime)).
return TRY(calendar_days_in_week(vm, calendar, *temporal_date_time)); return TRY(calendar_days_in_week(vm, calendar, *temporal_date_time));
} }
@ -591,7 +591,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::days_in_month_getter)
// 6. Let temporalDateTime be ? BuiltinTimeZoneGetPlainDateTimeFor(timeZone, instant, calendar). // 6. Let temporalDateTime be ? BuiltinTimeZoneGetPlainDateTimeFor(timeZone, instant, calendar).
auto* temporal_date_time = TRY(builtin_time_zone_get_plain_date_time_for(vm, &time_zone, *instant, calendar)); auto* temporal_date_time = TRY(builtin_time_zone_get_plain_date_time_for(vm, &time_zone, *instant, calendar));
// 7. Return ? CalendarDaysInMonth(calendar, temporalDateTime). // 7. Return 𝔽(? CalendarDaysInMonth(calendar, temporalDateTime)).
return TRY(calendar_days_in_month(vm, calendar, *temporal_date_time)); return TRY(calendar_days_in_month(vm, calendar, *temporal_date_time));
} }
@ -614,7 +614,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::days_in_year_getter)
// 6. Let temporalDateTime be ? BuiltinTimeZoneGetPlainDateTimeFor(timeZone, instant, calendar). // 6. Let temporalDateTime be ? BuiltinTimeZoneGetPlainDateTimeFor(timeZone, instant, calendar).
auto* temporal_date_time = TRY(builtin_time_zone_get_plain_date_time_for(vm, &time_zone, *instant, calendar)); auto* temporal_date_time = TRY(builtin_time_zone_get_plain_date_time_for(vm, &time_zone, *instant, calendar));
// 7. Return ? CalendarDaysInYear(calendar, temporalDateTime). // 7. Return 𝔽(? CalendarDaysInYear(calendar, temporalDateTime)).
return TRY(calendar_days_in_year(vm, calendar, *temporal_date_time)); return TRY(calendar_days_in_year(vm, calendar, *temporal_date_time));
} }
@ -637,7 +637,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::months_in_year_getter)
// 6. Let temporalDateTime be ? BuiltinTimeZoneGetPlainDateTimeFor(timeZone, instant, calendar). // 6. Let temporalDateTime be ? BuiltinTimeZoneGetPlainDateTimeFor(timeZone, instant, calendar).
auto* temporal_date_time = TRY(builtin_time_zone_get_plain_date_time_for(vm, &time_zone, *instant, calendar)); auto* temporal_date_time = TRY(builtin_time_zone_get_plain_date_time_for(vm, &time_zone, *instant, calendar));
// 7. Return ? CalendarMonthsInYear(calendar, temporalDateTime). // 7. Return 𝔽(? CalendarMonthsInYear(calendar, temporalDateTime)).
return TRY(calendar_months_in_year(vm, calendar, *temporal_date_time)); return TRY(calendar_months_in_year(vm, calendar, *temporal_date_time));
} }