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

LibJS: Port PrototypeObject::typed_this_object() to NonnullGCPtr

This commit is contained in:
Linus Groh 2023-04-13 20:09:41 +02:00 committed by Andreas Kling
parent 15360e50d3
commit a23dd88f61
36 changed files with 491 additions and 491 deletions

View file

@ -74,7 +74,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::id_getter)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Return calendar.[[Identifier]].
return { PrimitiveString::create(vm, calendar->identifier()) };
@ -86,7 +86,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::date_from_fields)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -103,7 +103,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::date_from_fields)
auto result = TRY(iso_date_from_fields(vm, fields.as_object(), *options));
// 7. Return ? CreateTemporalDate(result.[[Year]], result.[[Month]], result.[[Day]], calendar).
return TRY(create_temporal_date(vm, result.year, result.month, result.day, *calendar));
return TRY(create_temporal_date(vm, result.year, result.month, result.day, calendar));
}
// 12.4.5 Temporal.Calendar.prototype.yearMonthFromFields ( fields [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.yearmonthfromfields
@ -112,7 +112,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::year_month_from_fields)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -129,7 +129,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::year_month_from_fields)
auto result = TRY(iso_year_month_from_fields(vm, fields.as_object(), *options));
// 7. Return ? CreateTemporalYearMonth(result.[[Year]], result.[[Month]], calendar, result.[[ReferenceISODay]]).
return TRY(create_temporal_year_month(vm, result.year, result.month, *calendar, result.reference_iso_day));
return TRY(create_temporal_year_month(vm, result.year, result.month, calendar, result.reference_iso_day));
}
// 12.4.6 Temporal.Calendar.prototype.monthDayFromFields ( fields [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.monthdayfromfields
@ -138,7 +138,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::month_day_from_fields)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -155,7 +155,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::month_day_from_fields)
auto result = TRY(iso_month_day_from_fields(vm, fields.as_object(), *options));
// 7. Return ? CreateTemporalMonthDay(result.[[Month]], result.[[Day]], calendar, result.[[ReferenceISOYear]]).
return TRY(create_temporal_month_day(vm, result.month, result.day, *calendar, result.reference_iso_year));
return TRY(create_temporal_month_day(vm, result.month, result.day, calendar, result.reference_iso_year));
}
// 12.4.7 Temporal.Calendar.prototype.dateAdd ( date, duration [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.dateadd
@ -164,7 +164,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::date_add)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -188,7 +188,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::date_add)
auto result = TRY(add_iso_date(vm, date->iso_year(), date->iso_month(), date->iso_day(), duration->years(), duration->months(), duration->weeks(), balance_result.days, overflow));
// 10. Return ? CreateTemporalDate(result.[[Year]], result.[[Month]], result.[[Day]], calendar).
return TRY(create_temporal_date(vm, result.year, result.month, result.day, *calendar));
return TRY(create_temporal_date(vm, result.year, result.month, result.day, calendar));
}
// 12.4.8 Temporal.Calendar.prototype.dateUntil ( one, two [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.dateuntil
@ -197,7 +197,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::date_until)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -231,7 +231,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::year)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -256,7 +256,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::month)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -287,7 +287,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::month_code)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -312,7 +312,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::day)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -336,7 +336,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::day_of_week)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -354,7 +354,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::day_of_year)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -372,7 +372,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::week_of_year)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -393,7 +393,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::year_of_week)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -414,7 +414,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::days_in_week)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -432,7 +432,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::days_in_month)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -454,7 +454,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::days_in_year)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -476,7 +476,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::months_in_year)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -498,7 +498,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::in_leap_year)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -528,7 +528,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::fields)
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -595,7 +595,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::merge_fields)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Set fields to ? ToObject(fields).
auto fields = TRY(vm.argument(0).to_object(vm));
@ -615,7 +615,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::to_string)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Return calendar.[[Identifier]].
return PrimitiveString::create(vm, calendar->identifier());
@ -626,7 +626,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::to_json)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. Return ? ToString(calendar).
return PrimitiveString::create(vm, TRY(Value(calendar).to_string(vm)));
@ -639,7 +639,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::era)
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. If Type(temporalDateLike) is not Object or temporalDateLike does not have an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], or [[InitializedTemporalYearMonth]] internal slot, then
if (!temporal_date_like.is_object() || !(is<PlainDate>(temporal_date_like.as_object()) || is<PlainDateTime>(temporal_date_like.as_object()) || is<PlainYearMonth>(temporal_date_like.as_object()))) {
@ -667,7 +667,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::era_year)
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(vm));
auto calendar = TRY(typed_this_object(vm));
// 3. If Type(temporalDateLike) is not Object or temporalDateLike does not have an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], or [[InitializedTemporalYearMonth]] internal slot, then
if (!temporal_date_like.is_object() || !(is<PlainDate>(temporal_date_like.as_object()) || is<PlainDateTime>(temporal_date_like.as_object()) || is<PlainYearMonth>(temporal_date_like.as_object()))) {

View file

@ -63,7 +63,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::years_getter)
{
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(duration.[[Years]]).
return Value(duration->years());
@ -74,7 +74,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::months_getter)
{
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(duration.[[Months]]).
return Value(duration->months());
@ -85,7 +85,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::weeks_getter)
{
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(duration.[[Weeks]]).
return Value(duration->weeks());
@ -96,7 +96,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::days_getter)
{
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(duration.[[Days]]).
return Value(duration->days());
@ -107,7 +107,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::hours_getter)
{
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(duration.[[Hours]]).
return Value(duration->hours());
@ -118,7 +118,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::minutes_getter)
{
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(duration.[[Minutes]]).
return Value(duration->minutes());
@ -129,7 +129,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::seconds_getter)
{
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(duration.[[Seconds]]).
return Value(duration->seconds());
@ -140,7 +140,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::milliseconds_getter)
{
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(duration.[[Milliseconds]]).
return Value(duration->milliseconds());
@ -151,7 +151,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::microseconds_getter)
{
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(duration.[[Microseconds]]).
return Value(duration->microseconds());
@ -162,7 +162,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::nanoseconds_getter)
{
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(duration.[[Nanoseconds]]).
return Value(duration->nanoseconds());
@ -173,7 +173,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::sign_getter)
{
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(! DurationSign(duration.[[Years]], duration.[[Months]], duration.[[Weeks]], duration.[[Days]], duration.[[Hours]], duration.[[Minutes]], duration.[[Seconds]], duration.[[Milliseconds]], duration.[[Microseconds]], duration.[[Nanoseconds]])).
return Value(duration_sign(duration->years(), duration->months(), duration->weeks(), duration->days(), duration->hours(), duration->minutes(), duration->seconds(), duration->milliseconds(), duration->microseconds(), duration->nanoseconds()));
@ -184,7 +184,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::blank_getter)
{
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. Let sign be ! DurationSign(duration.[[Years]], duration.[[Months]], duration.[[Weeks]], duration.[[Days]], duration.[[Hours]], duration.[[Minutes]], duration.[[Seconds]], duration.[[Milliseconds]], duration.[[Microseconds]], duration.[[Nanoseconds]]).
auto sign = duration_sign(duration->years(), duration->months(), duration->weeks(), duration->days(), duration->hours(), duration->minutes(), duration->seconds(), duration->milliseconds(), duration->microseconds(), duration->nanoseconds());
@ -202,7 +202,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::with)
{
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. Let temporalDurationLike be ? ToTemporalPartialDurationRecord(temporalDurationLike).
auto temporal_duration_like = TRY(to_temporal_partial_duration_record(vm, vm.argument(0)));
@ -276,10 +276,10 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::negated)
{
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. Return ! CreateNegatedTemporalDuration(duration).
return create_negated_temporal_duration(vm, *duration);
return create_negated_temporal_duration(vm, duration);
}
// 7.3.17 Temporal.Duration.prototype.abs ( ), https://tc39.es/proposal-temporal/#sec-temporal.duration.prototype.abs
@ -287,7 +287,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::abs)
{
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. Return ! CreateTemporalDuration(abs(duration.[[Years]]), abs(duration.[[Months]]), abs(duration.[[Weeks]]), abs(duration.[[Days]]), abs(duration.[[Hours]]), abs(duration.[[Minutes]]), abs(duration.[[Seconds]]), abs(duration.[[Milliseconds]]), abs(duration.[[Microseconds]]), abs(duration.[[Nanoseconds]])).
return TRY(create_temporal_duration(vm, fabs(duration->years()), fabs(duration->months()), fabs(duration->weeks()), fabs(duration->days()), fabs(duration->hours()), fabs(duration->minutes()), fabs(duration->seconds()), fabs(duration->milliseconds()), fabs(duration->microseconds()), fabs(duration->nanoseconds())));
@ -301,10 +301,10 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::add)
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. Return ? AddDurationToOrSubtractDurationFromDuration(add, duration, other, options).
return TRY(add_duration_to_or_subtract_duration_from_duration(vm, ArithmeticOperation::Add, *duration, other, options));
return TRY(add_duration_to_or_subtract_duration_from_duration(vm, ArithmeticOperation::Add, duration, other, options));
}
// 7.3.19 Temporal.Duration.prototype.subtract ( other [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.duration.prototype.subtract
@ -315,10 +315,10 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::subtract)
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. Return ? AddDurationToOrSubtractDurationFromDuration(subtract, duration, other, options).
return TRY(add_duration_to_or_subtract_duration_from_duration(vm, ArithmeticOperation::Subtract, *duration, other, options));
return TRY(add_duration_to_or_subtract_duration_from_duration(vm, ArithmeticOperation::Subtract, duration, other, options));
}
// 7.3.20 Temporal.Duration.prototype.round ( roundTo ), https://tc39.es/proposal-temporal/#sec-temporal.duration.prototype.round
@ -328,7 +328,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::round)
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. If roundTo is undefined, then
if (vm.argument(0).is_undefined()) {
@ -451,7 +451,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::total)
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. If totalOf is undefined, throw a TypeError exception.
if (vm.argument(0).is_undefined())
@ -569,7 +569,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::to_string)
{
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. Set options to ? GetOptionsObject(options).
auto const* options = TRY(get_options_object(vm, vm.argument(0)));
@ -596,7 +596,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::to_json)
{
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. Return ! TemporalDurationToString(duration.[[Years]], duration.[[Months]], duration.[[Weeks]], duration.[[Days]], duration.[[Hours]], duration.[[Minutes]], duration.[[Seconds]], duration.[[Milliseconds]], duration.[[Microseconds]], duration.[[Nanoseconds]], "auto").
return PrimitiveString::create(vm, MUST_OR_THROW_OOM(temporal_duration_to_string(vm, duration->years(), duration->months(), duration->weeks(), duration->days(), duration->hours(), duration->minutes(), duration->seconds(), duration->milliseconds(), duration->microseconds(), duration->nanoseconds(), "auto"sv)));
@ -608,7 +608,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::to_locale_string)
{
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(vm));
auto duration = TRY(typed_this_object(vm));
// 3. Return ! TemporalDurationToString(duration.[[Years]], duration.[[Months]], duration.[[Weeks]], duration.[[Days]], duration.[[Hours]], duration.[[Minutes]], duration.[[Seconds]], duration.[[Milliseconds]], duration.[[Microseconds]], duration.[[Nanoseconds]], "auto").
return PrimitiveString::create(vm, MUST_OR_THROW_OOM(temporal_duration_to_string(vm, duration->years(), duration->months(), duration->weeks(), duration->days(), duration->hours(), duration->minutes(), duration->seconds(), duration->milliseconds(), duration->microseconds(), duration->nanoseconds(), "auto"sv)));

View file

@ -60,7 +60,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::epoch_seconds_getter)
{
// 1. Let instant be the this value.
// 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
auto* instant = TRY(typed_this_object(vm));
auto instant = TRY(typed_this_object(vm));
// 3. Let ns be instant.[[Nanoseconds]].
auto& ns = instant->nanoseconds();
@ -77,7 +77,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::epoch_milliseconds_getter)
{
// 1. Let instant be the this value.
// 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
auto* instant = TRY(typed_this_object(vm));
auto instant = TRY(typed_this_object(vm));
// 3. Let ns be instant.[[Nanoseconds]].
auto& ns = instant->nanoseconds();
@ -94,7 +94,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::epoch_microseconds_getter)
{
// 1. Let instant be the this value.
// 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
auto* instant = TRY(typed_this_object(vm));
auto instant = TRY(typed_this_object(vm));
// 3. Let ns be instant.[[Nanoseconds]].
auto& ns = instant->nanoseconds();
@ -111,7 +111,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::epoch_nanoseconds_getter)
{
// 1. Let instant be the this value.
// 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
auto* instant = TRY(typed_this_object(vm));
auto instant = TRY(typed_this_object(vm));
// 3. Let ns be instant.[[Nanoseconds]].
auto& ns = instant->nanoseconds();
@ -127,10 +127,10 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::add)
// 1. Let instant be the this value.
// 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
auto* instant = TRY(typed_this_object(vm));
auto instant = TRY(typed_this_object(vm));
// 3. Return ? AddDurationToOrSubtractDurationFromInstant(add, instant, temporalDurationLike).
return TRY(add_duration_to_or_subtract_duration_from_instant(vm, ArithmeticOperation::Add, *instant, temporal_duration_like));
return TRY(add_duration_to_or_subtract_duration_from_instant(vm, ArithmeticOperation::Add, instant, temporal_duration_like));
}
// 8.3.8 Temporal.Instant.prototype.subtract ( temporalDurationLike ), https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype.subtract
@ -140,10 +140,10 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::subtract)
// 1. Let instant be the this value.
// 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
auto* instant = TRY(typed_this_object(vm));
auto instant = TRY(typed_this_object(vm));
// 3. Return ? AddDurationToOrSubtractDurationFromInstant(subtract, instant, temporalDurationLike).
return TRY(add_duration_to_or_subtract_duration_from_instant(vm, ArithmeticOperation::Subtract, *instant, temporal_duration_like));
return TRY(add_duration_to_or_subtract_duration_from_instant(vm, ArithmeticOperation::Subtract, instant, temporal_duration_like));
}
// 8.3.9 Temporal.Instant.prototype.until ( other [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype.until
@ -154,10 +154,10 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::until)
// 1. Let instant be the this value.
// 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
auto* instant = TRY(typed_this_object(vm));
auto instant = TRY(typed_this_object(vm));
// 3. Return ? DifferenceTemporalInstant(until, instant, other, options).
return TRY(difference_temporal_instant(vm, DifferenceOperation::Until, *instant, other, options));
return TRY(difference_temporal_instant(vm, DifferenceOperation::Until, instant, other, options));
}
// 8.3.10 Temporal.Instant.prototype.since ( other [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype.since
@ -168,10 +168,10 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::since)
// 1. Let instant be the this value.
// 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
auto* instant = TRY(typed_this_object(vm));
auto instant = TRY(typed_this_object(vm));
// 3. Return ? DifferenceTemporalInstant(since, instant, other, options).
return TRY(difference_temporal_instant(vm, DifferenceOperation::Since, *instant, other, options));
return TRY(difference_temporal_instant(vm, DifferenceOperation::Since, instant, other, options));
}
// 8.3.11 Temporal.Instant.prototype.round ( roundTo ), https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype.round
@ -181,7 +181,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::round)
// 1. Let instant be the this value.
// 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
auto* instant = TRY(typed_this_object(vm));
auto instant = TRY(typed_this_object(vm));
// 3. If roundTo is undefined, then
if (vm.argument(0).is_undefined()) {
@ -269,7 +269,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::equals)
{
// 1. Let instant be the this value.
// 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
auto* instant = TRY(typed_this_object(vm));
auto instant = TRY(typed_this_object(vm));
// 3. Set other to ? ToTemporalInstant(other).
auto other = TRY(to_temporal_instant(vm, vm.argument(0)));
@ -287,7 +287,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::to_string)
{
// 1. Let instant be the this value.
// 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
auto* instant = TRY(typed_this_object(vm));
auto instant = TRY(typed_this_object(vm));
// 3. Set options to ? GetOptionsObject(options).
auto const* options = TRY(get_options_object(vm, vm.argument(0)));
@ -323,10 +323,10 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::to_locale_string)
{
// 1. Let instant be the this value.
// 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
auto* instant = TRY(typed_this_object(vm));
auto instant = TRY(typed_this_object(vm));
// 3. Return ? TemporalInstantToString(instant, undefined, "auto").
return PrimitiveString::create(vm, TRY(temporal_instant_to_string(vm, *instant, js_undefined(), "auto"sv)));
return PrimitiveString::create(vm, TRY(temporal_instant_to_string(vm, instant, js_undefined(), "auto"sv)));
}
// 8.3.15 Temporal.Instant.prototype.toJSON ( ), https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype.tojson
@ -334,10 +334,10 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::to_json)
{
// 1. Let instant be the this value.
// 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
auto* instant = TRY(typed_this_object(vm));
auto instant = TRY(typed_this_object(vm));
// 3. Return ? TemporalInstantToString(instant, undefined, "auto").
return PrimitiveString::create(vm, TRY(temporal_instant_to_string(vm, *instant, js_undefined(), "auto"sv)));
return PrimitiveString::create(vm, TRY(temporal_instant_to_string(vm, instant, js_undefined(), "auto"sv)));
}
// 8.3.16 Temporal.Instant.prototype.valueOf ( ), https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype.valueof
@ -354,7 +354,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::to_zoned_date_time)
// 1. Let instant be the this value.
// 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
auto* instant = TRY(typed_this_object(vm));
auto instant = TRY(typed_this_object(vm));
// 3. If Type(item) is not Object, then
if (!item.is_object()) {
@ -395,7 +395,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::to_zoned_date_time_iso)
{
// 1. Let instant be the this value.
// 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
auto* instant = TRY(typed_this_object(vm));
auto instant = TRY(typed_this_object(vm));
// 3. Set timeZone to ? ToTemporalTimeZone(timeZone).
auto* time_zone = TRY(to_temporal_time_zone(vm, vm.argument(0)));

View file

@ -77,7 +77,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::calendar_getter)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Return temporalDate.[[Calendar]].
return Value(&temporal_date->calendar());
@ -88,13 +88,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::year_getter)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
// 4. Return 𝔽(? CalendarYear(calendar, temporalDate)).
return 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
@ -102,13 +102,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::month_getter)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
// 4. Return 𝔽(? CalendarMonth(calendar, temporalDate)).
return 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
@ -116,13 +116,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::month_code_getter)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
// 4. Return ? CalendarMonthCode(calendar, temporalDate).
return PrimitiveString::create(vm, TRY(calendar_month_code(vm, calendar, *temporal_date)));
return PrimitiveString::create(vm, TRY(calendar_month_code(vm, calendar, temporal_date)));
}
// 3.3.7 get Temporal.PlainDate.prototype.day, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.day
@ -130,13 +130,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::day_getter)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
// 4. Return 𝔽(? CalendarDay(calendar, temporalDate)).
return 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
@ -144,13 +144,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::day_of_week_getter)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
// Return 𝔽(? CalendarDayOfWeek(calendar, temporalDate)).
return 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
@ -158,13 +158,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::day_of_year_getter)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
// 4. Return 𝔽(? CalendarDayOfYear(calendar, temporalDate)).
return 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
@ -172,13 +172,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::week_of_year_getter)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
// 4. Return 𝔽(? CalendarWeekOfYear(calendar, temporalDate)).
return 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
@ -186,13 +186,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::year_of_week_getter)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
// 4. Return 𝔽(? CalendarYearOfWeek(calendar, temporalDate)).
return 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
@ -200,13 +200,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::days_in_week_getter)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
// 4. Return 𝔽(? CalendarDaysInWeek(calendar, temporalDate)).
return 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
@ -214,13 +214,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::days_in_month_getter)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
// 4. Return 𝔽(? CalendarDaysInMonth(calendar, temporalDate)).
return 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
@ -228,13 +228,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::days_in_year_getter)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
// 4. Return 𝔽(? CalendarDaysInYear(calendar, temporalDate)).
return 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
@ -242,13 +242,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::months_in_year_getter)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
// 4. Return 𝔽(? CalendarMonthsInYear(calendar, temporalDate)).
return 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
@ -256,13 +256,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::in_leap_year_getter)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
// 4. Return ? CalendarInLeapYear(calendar, temporalDate).
return Value(TRY(calendar_in_leap_year(vm, calendar, *temporal_date)));
return Value(TRY(calendar_in_leap_year(vm, calendar, temporal_date)));
}
// 15.6.5.2 get Temporal.PlainDate.prototype.era, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.era
@ -270,13 +270,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::era_getter)
{
// 1. Let plainDate be the this value.
// 2. Perform ? RequireInternalSlot(plainDate, [[InitializedTemporalDate]]).
auto* plain_date = TRY(typed_this_object(vm));
auto plain_date = TRY(typed_this_object(vm));
// 3. Let calendar be plainDate.[[Calendar]].
auto& calendar = plain_date->calendar();
// 4. Return ? CalendarEra(calendar, plainDate).
return TRY(calendar_era(vm, calendar, *plain_date));
return TRY(calendar_era(vm, calendar, plain_date));
}
// 15.6.5.3 get Temporal.PlainDate.prototype.eraYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.erayear
@ -284,13 +284,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::era_year_getter)
{
// 1. Let plainDate be the this value.
// 2. Perform ? RequireInternalSlot(plainDate, [[InitializedTemporalDate]]).
auto* plain_date = TRY(typed_this_object(vm));
auto plain_date = TRY(typed_this_object(vm));
// 3. Let calendar be plainDate.[[Calendar]].
auto& calendar = plain_date->calendar();
// 4. Return ? CalendarEraYear(calendar, plainDate).
return TRY(calendar_era_year(vm, calendar, *plain_date));
return TRY(calendar_era_year(vm, calendar, plain_date));
}
// 3.3.17 Temporal.PlainDate.prototype.toPlainYearMonth ( ), https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.toplainyearmonth
@ -298,7 +298,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_plain_year_month)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
@ -307,7 +307,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_plain_year_month)
auto field_names = TRY(calendar_fields(vm, calendar, { "monthCode"sv, "year"sv }));
// 5. Let fields be ? PrepareTemporalFields(temporalDate, fieldNames, «»).
auto* fields = TRY(prepare_temporal_fields(vm, *temporal_date, field_names, Vector<StringView> {}));
auto* fields = TRY(prepare_temporal_fields(vm, temporal_date, field_names, Vector<StringView> {}));
// 6. Return ? CalendarYearMonthFromFields(calendar, fields).
return TRY(calendar_year_month_from_fields(vm, calendar, *fields));
@ -318,7 +318,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_plain_month_day)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
@ -327,7 +327,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_plain_month_day)
auto field_names = TRY(calendar_fields(vm, calendar, { "day"sv, "monthCode"sv }));
// 5. Let fields be ? PrepareTemporalFields(temporalDate, fieldNames, «»).
auto* fields = TRY(prepare_temporal_fields(vm, *temporal_date, field_names, Vector<StringView> {}));
auto* fields = TRY(prepare_temporal_fields(vm, temporal_date, field_names, Vector<StringView> {}));
// 6. Return ? CalendarMonthDayFromFields(calendar, fields).
return TRY(calendar_month_day_from_fields(vm, calendar, *fields));
@ -340,7 +340,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::get_iso_fields)
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Let fields be OrdinaryObjectCreate(%Object.prototype%).
auto fields = Object::create(realm, realm.intrinsics().object_prototype());
@ -366,7 +366,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::add)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Let duration be ? ToTemporalDuration(temporalDurationLike).
auto* duration = TRY(to_temporal_duration(vm, vm.argument(0)));
@ -383,7 +383,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::subtract)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Let duration be ? ToTemporalDuration(temporalDurationLike).
auto* duration = TRY(to_temporal_duration(vm, vm.argument(0)));
@ -405,7 +405,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::with)
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. If Type(temporalDateLike) is not Object, then
if (!temporal_date_like.is_object()) {
@ -429,7 +429,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::with)
auto const* options = TRY(get_options_object(vm, vm.argument(1)));
// 9. Let fields be ? PrepareTemporalFields(temporalDate, fieldNames, «»).
auto* fields = TRY(prepare_temporal_fields(vm, *temporal_date, field_names, Vector<StringView> {}));
auto* fields = TRY(prepare_temporal_fields(vm, temporal_date, field_names, Vector<StringView> {}));
// 10. Set fields to ? CalendarMergeFields(calendar, fields, partialDate).
fields = TRY(calendar_merge_fields(vm, calendar, *fields, *partial_date));
@ -448,7 +448,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::with_calendar)
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be ? ToTemporalCalendar(calendarLike).
auto* calendar = TRY(to_temporal_calendar(vm, calendar_like));
@ -465,10 +465,10 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::until)
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Return ? DifferenceTemporalPlainDate(until, temporalDate, other, options).
return TRY(difference_temporal_plain_date(vm, DifferenceOperation::Until, *temporal_date, other, options));
return TRY(difference_temporal_plain_date(vm, DifferenceOperation::Until, temporal_date, other, options));
}
// 3.3.25 Temporal.PlainDate.prototype.since ( other [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.since
@ -479,10 +479,10 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::since)
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Return ? DifferenceTemporalPlainDate(since, temporalDate, other, options).
return TRY(difference_temporal_plain_date(vm, DifferenceOperation::Since, *temporal_date, other, options));
return TRY(difference_temporal_plain_date(vm, DifferenceOperation::Since, temporal_date, other, options));
}
// 3.3.26 Temporal.PlainDate.prototype.equals ( other ), https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.equals
@ -490,7 +490,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::equals)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Set other to ? ToTemporalDate(other).
auto* other = TRY(to_temporal_date(vm, vm.argument(0)));
@ -513,7 +513,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_plain_date_time)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. If temporalTime is undefined, then
if (vm.argument(0).is_undefined()) {
@ -535,7 +535,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_zoned_date_time)
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
auto temporal_time_value = js_undefined();
Object* time_zone;
@ -607,7 +607,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_string)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Set options to ? GetOptionsObject(options).
auto* options = TRY(get_options_object(vm, vm.argument(0)));
@ -616,7 +616,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_string)
auto show_calendar = TRY(to_calendar_name_option(vm, *options));
// 5. Return ? TemporalDateToString(temporalDate, showCalendar).
return PrimitiveString::create(vm, TRY(temporal_date_to_string(vm, *temporal_date, show_calendar)));
return PrimitiveString::create(vm, TRY(temporal_date_to_string(vm, temporal_date, show_calendar)));
}
// 3.3.30 Temporal.PlainDate.prototype.toLocaleString ( [ locales [ , options ] ] ), https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.tolocalestring
@ -625,10 +625,10 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_locale_string)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Return ? TemporalDateToString(temporalDate, "auto").
return PrimitiveString::create(vm, TRY(temporal_date_to_string(vm, *temporal_date, "auto"sv)));
return PrimitiveString::create(vm, TRY(temporal_date_to_string(vm, temporal_date, "auto"sv)));
}
// 3.3.31 Temporal.PlainDate.prototype.toJSON ( ), https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.tojson
@ -636,10 +636,10 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_json)
{
// 1. Let temporalDate be the this value.
// 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporalDate]]).
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_date = TRY(typed_this_object(vm));
// 3. Return ? TemporalDateToString(temporalDate, "auto").
return PrimitiveString::create(vm, TRY(temporal_date_to_string(vm, *temporal_date, "auto"sv)));
return PrimitiveString::create(vm, TRY(temporal_date_to_string(vm, temporal_date, "auto"sv)));
}
// 3.3.32 Temporal.PlainDate.prototype.valueOf ( ), https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.valueof

View file

@ -88,7 +88,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::calendar_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Return dateTime.[[Calendar]].
return Value(&date_time->calendar());
@ -99,13 +99,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::year_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 4. Return 𝔽(? CalendarYear(calendar, dateTime)).
return 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
@ -113,13 +113,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::month_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 4. Return 𝔽(? CalendarMonth(calendar, dateTime)).
return 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
@ -127,13 +127,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::month_code_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 4. Return ? CalendarMonthCode(calendar, dateTime).
return PrimitiveString::create(vm, TRY(calendar_month_code(vm, calendar, *date_time)));
return PrimitiveString::create(vm, TRY(calendar_month_code(vm, calendar, date_time)));
}
// 5.3.7 get Temporal.PlainDateTime.prototype.day, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.day
@ -141,13 +141,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::day_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 4. Return 𝔽(? CalendarDay(calendar, dateTime)).
return 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
@ -155,7 +155,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::hour_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(dateTime.[[ISOHour]]).
return Value(date_time->iso_hour());
@ -166,7 +166,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::minute_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(dateTime.[[ISOMinute]]).
return Value(date_time->iso_minute());
@ -177,7 +177,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::second_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(dateTime.[[ISOSecond]]).
return Value(date_time->iso_second());
@ -188,7 +188,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::millisecond_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(dateTime.[[ISOMillisecond]]).
return Value(date_time->iso_millisecond());
@ -199,7 +199,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::microsecond_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(dateTime.[[ISOMicrosecond]]).
return Value(date_time->iso_microsecond());
@ -210,7 +210,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::nanosecond_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(dateTime.[[ISONanosecond]]).
return Value(date_time->iso_nanosecond());
@ -221,13 +221,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::day_of_week_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 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));
}
// 5.3.15 get Temporal.PlainDateTime.prototype.dayOfYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.dayofyear
@ -235,13 +235,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::day_of_year_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 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));
}
// 5.3.16 get Temporal.PlainDateTime.prototype.weekOfYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.weekofyear
@ -249,13 +249,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::week_of_year_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 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));
}
// 5.3.17 get Temporal.PlainDateTime.prototype.yearOfWeek, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.yearofweek
@ -263,13 +263,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::year_of_week_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 4. Return 𝔽(? CalendarYearOfWeek(calendar, dateTime)).
return TRY(calendar_year_of_week(vm, calendar, *date_time));
return TRY(calendar_year_of_week(vm, calendar, date_time));
}
// 5.3.18 get Temporal.PlainDateTime.prototype.daysInWeek, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.daysinweek
@ -277,13 +277,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::days_in_week_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 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));
}
// 5.3.19 get Temporal.PlainDateTime.prototype.daysInMonth, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.daysinmonth
@ -291,13 +291,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::days_in_month_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 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));
}
// 5.3.20 get Temporal.PlainDateTime.prototype.daysInYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.daysinyear
@ -305,13 +305,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::days_in_year_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 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));
}
// 5.3.21 get Temporal.PlainDateTime.prototype.monthsInYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.monthsinyear
@ -319,13 +319,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::months_in_year_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 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));
}
// 5.3.22 get Temporal.PlainDateTime.prototype.inLeapYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.inleapyear
@ -333,13 +333,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::in_leap_year_getter)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
// 4. Return ? CalendarInLeapYear(calendar, dateTime).
return TRY(calendar_in_leap_year(vm, calendar, *date_time));
return TRY(calendar_in_leap_year(vm, calendar, date_time));
}
// 15.6.6.2 get Temporal.PlainDateTime.prototype.era, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.era
@ -347,13 +347,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::era_getter)
{
// 1. Let plainDateTime be the this value.
// 2. Perform ? RequireInternalSlot(plainDateTime, [[InitializedTemporalDateTime]]).
auto* plain_date_time = TRY(typed_this_object(vm));
auto plain_date_time = TRY(typed_this_object(vm));
// 3. Let calendar be plainDateTime.[[Calendar]].
auto& calendar = plain_date_time->calendar();
// 4. Return ? CalendarEra(calendar, plainDateTime).
return TRY(calendar_era(vm, calendar, *plain_date_time));
return TRY(calendar_era(vm, calendar, plain_date_time));
}
// 15.6.6.3 get Temporal.PlainDateTime.prototype.eraYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.erayear
@ -361,13 +361,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::era_year_getter)
{
// 1. Let plainDateTime be the this value.
// 2. Perform ? RequireInternalSlot(plainDateTime, [[InitializedTemporalDateTime]]).
auto* plain_date_time = TRY(typed_this_object(vm));
auto plain_date_time = TRY(typed_this_object(vm));
// 3. Let calendar be plainDateTime.[[Calendar]].
auto& calendar = plain_date_time->calendar();
// 4. Return ? CalendarEraYear(calendar, plainDateTime).
return TRY(calendar_era_year(vm, calendar, *plain_date_time));
return TRY(calendar_era_year(vm, calendar, plain_date_time));
}
// 5.3.23 Temporal.PlainDateTime.prototype.with ( temporalDateTimeLike [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.with
@ -377,7 +377,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::with)
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. If Type(temporalDateTimeLike) is not Object, then
if (!temporal_date_time_like.is_object()) {
@ -401,7 +401,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::with)
auto* options = TRY(get_options_object(vm, vm.argument(1)));
// 9. Let fields be ? PrepareTemporalFields(dateTime, fieldNames, «»).
auto* fields = TRY(prepare_temporal_fields(vm, *date_time, field_names, Vector<StringView> {}));
auto* fields = TRY(prepare_temporal_fields(vm, date_time, field_names, Vector<StringView> {}));
// 10. Set fields to ? CalendarMergeFields(calendar, fields, partialDateTime).
fields = TRY(calendar_merge_fields(vm, calendar, *fields, *partial_date_time));
@ -427,7 +427,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::with_plain_time)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. If plainTimeLike is undefined, then
if (vm.argument(0).is_undefined()) {
@ -447,7 +447,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::with_plain_date)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Let plainDate be ? ToTemporalDate(plainDateLike).
auto* plain_date = TRY(to_temporal_date(vm, vm.argument(0)));
@ -466,7 +466,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::with_calendar)
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Let calendar be ? ToTemporalCalendar(calendarLike).
auto* calendar = TRY(to_temporal_calendar(vm, calendar_like));
@ -483,10 +483,10 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::add)
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Return ? AddDurationToOrSubtractDurationFromPlainDateTime(add, dateTime, temporalDurationLike, options).
return TRY(add_duration_to_or_subtract_duration_from_plain_date_time(vm, ArithmeticOperation::Add, *date_time, temporal_duration_like, options));
return TRY(add_duration_to_or_subtract_duration_from_plain_date_time(vm, ArithmeticOperation::Add, date_time, temporal_duration_like, options));
}
// 5.3.28 Temporal.PlainDateTime.prototype.subtract ( temporalDurationLike [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.subtract
@ -497,10 +497,10 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::subtract)
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Return ? AddDurationToOrSubtractDurationFromPlainDateTime(subtract, dateTime, temporalDurationLike, options).
return TRY(add_duration_to_or_subtract_duration_from_plain_date_time(vm, ArithmeticOperation::Subtract, *date_time, temporal_duration_like, options));
return TRY(add_duration_to_or_subtract_duration_from_plain_date_time(vm, ArithmeticOperation::Subtract, date_time, temporal_duration_like, options));
}
// 5.3.29 Temporal.PlainDateTime.prototype.until ( other [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.plaintime.prototype.since
@ -511,10 +511,10 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::until)
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Return ? DifferenceTemporalPlainDateTime(until, dateTime, other, options).
return TRY(difference_temporal_plain_date_time(vm, DifferenceOperation::Until, *date_time, other, options));
return TRY(difference_temporal_plain_date_time(vm, DifferenceOperation::Until, date_time, other, options));
}
// 5.3.30 Temporal.PlainDateTime.prototype.since ( other [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.since
@ -525,10 +525,10 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::since)
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Return ? DifferenceTemporalPlainDateTime(since, dateTime, other, options).
return TRY(difference_temporal_plain_date_time(vm, DifferenceOperation::Since, *date_time, other, options));
return TRY(difference_temporal_plain_date_time(vm, DifferenceOperation::Since, date_time, other, options));
}
// 5.3.31 Temporal.PlainDateTime.prototype.round ( roundTo ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.round
@ -538,7 +538,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::round)
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. If roundTo is undefined, then
if (vm.argument(0).is_undefined()) {
@ -585,7 +585,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::equals)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Set other to ? ToTemporalDateTime(other).
auto* other = TRY(to_temporal_date_time(vm, vm.argument(0)));
@ -606,7 +606,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_string)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Set options to ? GetOptionsObject(options).
auto* options = TRY(get_options_object(vm, vm.argument(0)));
@ -633,7 +633,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_locale_string)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Return ? TemporalDateTimeToString(dateTime.[[ISOYear]], dateTime.[[ISOMonth]], dateTime.[[ISODay]], dateTime.[[ISOHour]], dateTime.[[ISOMinute]], dateTime.[[ISOSecond]], dateTime.[[ISOMillisecond]], dateTime.[[ISOMicrosecond]], dateTime.[[ISONanosecond]], dateTime.[[Calendar]], "auto", "auto").
return PrimitiveString::create(vm, TRY(temporal_date_time_to_string(vm, date_time->iso_year(), date_time->iso_month(), date_time->iso_day(), date_time->iso_hour(), date_time->iso_minute(), date_time->iso_second(), date_time->iso_millisecond(), date_time->iso_microsecond(), date_time->iso_nanosecond(), &date_time->calendar(), "auto"sv, "auto"sv)));
@ -644,7 +644,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_json)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Return ? TemporalDateTimeToString(dateTime.[[ISOYear]], dateTime.[[ISOMonth]], dateTime.[[ISODay]], dateTime.[[ISOHour]], dateTime.[[ISOMinute]], dateTime.[[ISOSecond]], dateTime.[[ISOMillisecond]], dateTime.[[ISOMicrosecond]], dateTime.[[ISONanosecond]], dateTime.[[Calendar]], "auto", "auto").
return PrimitiveString::create(vm, TRY(temporal_date_time_to_string(vm, date_time->iso_year(), date_time->iso_month(), date_time->iso_day(), date_time->iso_hour(), date_time->iso_minute(), date_time->iso_second(), date_time->iso_millisecond(), date_time->iso_microsecond(), date_time->iso_nanosecond(), &date_time->calendar(), "auto"sv, "auto"sv)));
@ -662,7 +662,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_zoned_date_time)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be ? ToTemporalTimeZone(temporalTimeZoneLike).
auto* time_zone = TRY(to_temporal_time_zone(vm, vm.argument(0)));
@ -674,7 +674,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_zoned_date_time)
auto disambiguation = TRY(to_temporal_disambiguation(vm, options));
// 6. Let instant be ? BuiltinTimeZoneGetInstantFor(timeZone, dateTime, disambiguation).
auto* instant = TRY(builtin_time_zone_get_instant_for(vm, time_zone, *date_time, disambiguation));
auto* instant = TRY(builtin_time_zone_get_instant_for(vm, time_zone, date_time, disambiguation));
// 7. Return ! CreateTemporalZonedDateTime(instant.[[Nanoseconds]], timeZone, dateTime.[[Calendar]]).
return MUST(create_temporal_zoned_date_time(vm, instant->nanoseconds(), *time_zone, date_time->calendar()));
@ -685,7 +685,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_date)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Return ! CreateTemporalDate(dateTime.[[ISOYear]], dateTime.[[ISOMonth]], dateTime.[[ISODay]], dateTime.[[Calendar]]).
return MUST(create_temporal_date(vm, date_time->iso_year(), date_time->iso_month(), date_time->iso_day(), date_time->calendar()));
@ -696,7 +696,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_year_month)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
@ -705,7 +705,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_year_month)
auto field_names = TRY(calendar_fields(vm, calendar, { "monthCode"sv, "year"sv }));
// 5. Let fields be ? PrepareTemporalFields(dateTime, fieldNames, «»).
auto* fields = TRY(prepare_temporal_fields(vm, *date_time, field_names, Vector<StringView> {}));
auto* fields = TRY(prepare_temporal_fields(vm, date_time, field_names, Vector<StringView> {}));
// 6. Return ? CalendarYearMonthFromFields(calendar, fields).
return TRY(calendar_year_month_from_fields(vm, calendar, *fields));
@ -716,7 +716,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_month_day)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
@ -725,7 +725,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_month_day)
auto field_names = TRY(calendar_fields(vm, calendar, { "day"sv, "monthCode"sv }));
// 5. Let fields be ? PrepareTemporalFields(dateTime, fieldNames, «»).
auto* fields = TRY(prepare_temporal_fields(vm, *date_time, field_names, Vector<StringView> {}));
auto* fields = TRY(prepare_temporal_fields(vm, date_time, field_names, Vector<StringView> {}));
// 6. Return ? CalendarMonthDayFromFields(calendar, fields).
return TRY(calendar_month_day_from_fields(vm, calendar, *fields));
@ -736,7 +736,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_time)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Return ! CreateTemporalTime(dateTime.[[ISOHour]], dateTime.[[ISOMinute]], dateTime.[[ISOSecond]], dateTime.[[ISOMillisecond]], dateTime.[[ISOMicrosecond]], dateTime.[[ISONanosecond]]).
return MUST(create_temporal_time(vm, date_time->iso_hour(), date_time->iso_minute(), date_time->iso_second(), date_time->iso_millisecond(), date_time->iso_microsecond(), date_time->iso_nanosecond()));
@ -749,7 +749,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::get_iso_fields)
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(vm));
auto date_time = TRY(typed_this_object(vm));
// 3. Let fields be OrdinaryObjectCreate(%Object.prototype%).
auto fields = Object::create(realm, realm.intrinsics().object_prototype());

View file

@ -51,7 +51,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::calendar_getter)
{
// 1. Let monthDay be the this value.
// 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]).
auto* month_day = TRY(typed_this_object(vm));
auto month_day = TRY(typed_this_object(vm));
// 3. Return monthDay.[[Calendar]].
return Value(&month_day->calendar());
@ -62,13 +62,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::month_code_getter)
{
// 1. Let monthDay be the this value.
// 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]).
auto* month_day = TRY(typed_this_object(vm));
auto month_day = TRY(typed_this_object(vm));
// 3. Let calendar be monthDay.[[Calendar]].
auto& calendar = month_day->calendar();
// 4. Return ? CalendarMonthCode(calendar, monthDay).
return PrimitiveString::create(vm, TRY(calendar_month_code(vm, calendar, *month_day)));
return PrimitiveString::create(vm, TRY(calendar_month_code(vm, calendar, month_day)));
}
// 10.3.5 get Temporal.PlainMonthDay.prototype.day, https://tc39.es/proposal-temporal/#sec-get-temporal.plainmonthday.prototype.day
@ -76,13 +76,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::day_getter)
{
// 1. Let monthDay be the this value.
// 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]).
auto* month_day = TRY(typed_this_object(vm));
auto month_day = TRY(typed_this_object(vm));
// 3. Let calendar be monthDay.[[Calendar]].
auto& calendar = month_day->calendar();
// 4. Return 𝔽(? CalendarDay(calendar, monthDay)).
return Value(TRY(calendar_day(vm, calendar, *month_day)));
return Value(TRY(calendar_day(vm, calendar, month_day)));
}
// 10.3.6 Temporal.PlainMonthDay.prototype.with ( temporalMonthDayLike [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.plainmonthday.prototype.with
@ -92,7 +92,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::with)
// 1. Let monthDay be the this value.
// 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]).
auto* month_day = TRY(typed_this_object(vm));
auto month_day = TRY(typed_this_object(vm));
// 3. If Type(temporalMonthDayLike) is not Object, then
if (!temporal_month_day_like.is_object()) {
@ -116,7 +116,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::with)
auto* options = TRY(get_options_object(vm, vm.argument(1)));
// 9. Let fields be ? PrepareTemporalFields(monthDay, fieldNames, «»).
auto* fields = TRY(prepare_temporal_fields(vm, *month_day, field_names, Vector<StringView> {}));
auto* fields = TRY(prepare_temporal_fields(vm, month_day, field_names, Vector<StringView> {}));
// 10. Set fields to ? CalendarMergeFields(calendar, fields, partialMonthDay).
fields = TRY(calendar_merge_fields(vm, calendar, *fields, *partial_month_day));
@ -133,7 +133,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::equals)
{
// 1. Let monthDay be the this value.
// 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]).
auto* month_day = TRY(typed_this_object(vm));
auto month_day = TRY(typed_this_object(vm));
// 3. Set other to ? ToTemporalMonthDay(other).
auto* other = TRY(to_temporal_month_day(vm, vm.argument(0)));
@ -159,7 +159,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::to_string)
{
// 1. Let monthDay be the this value.
// 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]).
auto* month_day = TRY(typed_this_object(vm));
auto month_day = TRY(typed_this_object(vm));
// 3. Set options to ? GetOptionsObject(options).
auto* options = TRY(get_options_object(vm, vm.argument(0)));
@ -168,7 +168,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::to_string)
auto show_calendar = TRY(to_calendar_name_option(vm, *options));
// 5. Return ? TemporalMonthDayToString(monthDay, showCalendar).
return PrimitiveString::create(vm, TRY(temporal_month_day_to_string(vm, *month_day, show_calendar)));
return PrimitiveString::create(vm, TRY(temporal_month_day_to_string(vm, month_day, show_calendar)));
}
// 10.3.9 Temporal.PlainMonthDay.prototype.toLocaleString ( [ locales [ , options ] ] ), https://tc39.es/proposal-temporal/#sec-temporal.plainmonthday.prototype.tolocalestring
@ -177,10 +177,10 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::to_locale_string)
{
// 1. Let monthDay be the this value.
// 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]).
auto* month_day = TRY(typed_this_object(vm));
auto month_day = TRY(typed_this_object(vm));
// 3. Return ? TemporalMonthDayToString(monthDay, "auto").
return PrimitiveString::create(vm, TRY(temporal_month_day_to_string(vm, *month_day, "auto"sv)));
return PrimitiveString::create(vm, TRY(temporal_month_day_to_string(vm, month_day, "auto"sv)));
}
// 10.3.10 Temporal.PlainMonthDay.prototype.toJSON ( ), https://tc39.es/proposal-temporal/#sec-temporal.plainmonthday.prototype.tojson
@ -188,10 +188,10 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::to_json)
{
// 1. Let monthDay be the this value.
// 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]).
auto* month_day = TRY(typed_this_object(vm));
auto month_day = TRY(typed_this_object(vm));
// 3. Return ? TemporalMonthDayToString(monthDay, "auto").
return PrimitiveString::create(vm, TRY(temporal_month_day_to_string(vm, *month_day, "auto"sv)));
return PrimitiveString::create(vm, TRY(temporal_month_day_to_string(vm, month_day, "auto"sv)));
}
// 10.3.11 Temporal.PlainMonthDay.prototype.valueOf ( ), https://tc39.es/proposal-temporal/#sec-temporal.plainmonthday.prototype.valueof
@ -210,7 +210,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::to_plain_date)
// 1. Let monthDay be the this value.
// 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]).
auto* month_day = TRY(typed_this_object(vm));
auto month_day = TRY(typed_this_object(vm));
// 3. If Type(item) is not Object, then
if (!item.is_object()) {
@ -225,7 +225,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::to_plain_date)
auto receiver_field_names = TRY(calendar_fields(vm, calendar, { "day"sv, "monthCode"sv }));
// 6. Let fields be ? PrepareTemporalFields(monthDay, receiverFieldNames, «»).
auto* fields = TRY(prepare_temporal_fields(vm, *month_day, receiver_field_names, Vector<StringView> {}));
auto* fields = TRY(prepare_temporal_fields(vm, month_day, receiver_field_names, Vector<StringView> {}));
// 7. Let inputFieldNames be ? CalendarFields(calendar, « "year" »).
auto input_field_names = TRY(calendar_fields(vm, calendar, { "year"sv }));
@ -259,7 +259,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::get_iso_fields)
// 1. Let monthDay be the this value.
// 2. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]).
auto* month_day = TRY(typed_this_object(vm));
auto month_day = TRY(typed_this_object(vm));
// 3. Let fields be OrdinaryObjectCreate(%Object.prototype%).
auto fields = Object::create(realm, realm.intrinsics().object_prototype());

View file

@ -66,7 +66,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::calendar_getter)
{
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time = TRY(typed_this_object(vm));
// 3. Return temporalTime.[[Calendar]].
return Value(&temporal_time->calendar());
@ -77,7 +77,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::hour_getter)
{
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(temporalTime.[[ISOHour]]).
return Value(temporal_time->iso_hour());
@ -88,7 +88,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::minute_getter)
{
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(temporalTime.[[ISOMinute]]).
return Value(temporal_time->iso_minute());
@ -99,7 +99,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::second_getter)
{
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(temporalTime.[[ISOSecond]]).
return Value(temporal_time->iso_second());
@ -110,7 +110,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::millisecond_getter)
{
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(temporalTime.[[ISOMillisecond]]).
return Value(temporal_time->iso_millisecond());
@ -121,7 +121,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::microsecond_getter)
{
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(temporalTime.[[ISOMicrosecond]]).
return Value(temporal_time->iso_microsecond());
@ -132,7 +132,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::nanosecond_getter)
{
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(temporalTime.[[ISONanosecond]]).
return Value(temporal_time->iso_nanosecond());
@ -145,10 +145,10 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::add)
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time = TRY(typed_this_object(vm));
// 3. Return ? AddDurationToOrSubtractDurationFromPlainTime(add, temporalTime, temporalDurationLike).
return TRY(add_duration_to_or_subtract_duration_from_plain_time(vm, ArithmeticOperation::Add, *temporal_time, temporal_duration_like));
return TRY(add_duration_to_or_subtract_duration_from_plain_time(vm, ArithmeticOperation::Add, temporal_time, temporal_duration_like));
}
// 4.3.11 Temporal.PlainTime.prototype.subtract ( temporalDurationLike ), https://tc39.es/proposal-temporal/#sec-temporal.plaintime.prototype.subtract
@ -158,10 +158,10 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::subtract)
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time = TRY(typed_this_object(vm));
// 3. Return ? AddDurationToOrSubtractDurationFromPlainTime(subtract, temporalTime, temporalDurationLike).
return TRY(add_duration_to_or_subtract_duration_from_plain_time(vm, ArithmeticOperation::Subtract, *temporal_time, temporal_duration_like));
return TRY(add_duration_to_or_subtract_duration_from_plain_time(vm, ArithmeticOperation::Subtract, temporal_time, temporal_duration_like));
}
// 4.3.12 Temporal.PlainTime.prototype.with ( temporalTimeLike [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.plaintime.prototype.with
@ -169,7 +169,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::with)
{
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time = TRY(typed_this_object(vm));
auto temporal_time_like_argument = vm.argument(0);
@ -244,10 +244,10 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::until)
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time = TRY(typed_this_object(vm));
// 3. Return ? DifferenceTemporalPlainTime(until, temporalTime, other, options).
return TRY(difference_temporal_plain_time(vm, DifferenceOperation::Until, *temporal_time, other, options));
return TRY(difference_temporal_plain_time(vm, DifferenceOperation::Until, temporal_time, other, options));
}
// 4.3.14 Temporal.PlainTime.prototype.since ( other [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.plaintime.prototype.since
@ -258,10 +258,10 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::since)
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time = TRY(typed_this_object(vm));
// 3. Return ? DifferenceTemporalPlainTime(since, temporalTime, other, options).
return TRY(difference_temporal_plain_time(vm, DifferenceOperation::Since, *temporal_time, other, options));
return TRY(difference_temporal_plain_time(vm, DifferenceOperation::Since, temporal_time, other, options));
}
// 4.3.15 Temporal.PlainTime.prototype.round ( roundTo ), https://tc39.es/proposal-temporal/#sec-temporal.plaintime.prototype.round
@ -271,7 +271,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::round)
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time = TRY(typed_this_object(vm));
// 3. If roundTo is undefined, then
if (vm.argument(0).is_undefined()) {
@ -321,7 +321,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::equals)
{
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time = TRY(typed_this_object(vm));
// 3. Set other to ? ToTemporalTime(other).
auto* other = TRY(to_temporal_time(vm, vm.argument(0)));
@ -359,7 +359,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::to_plain_date_time)
{
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time = TRY(typed_this_object(vm));
// 3. Set temporalDate to ? ToTemporalDate(temporalDate).
auto* temporal_date = TRY(to_temporal_date(vm, vm.argument(0)));
@ -375,7 +375,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::to_zoned_date_time)
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time = TRY(typed_this_object(vm));
// 3. If Type(item) is not Object, then
if (!item.is_object()) {
@ -424,7 +424,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::get_iso_fields)
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time = TRY(typed_this_object(vm));
// 3. Let fields be OrdinaryObjectCreate(%Object.prototype%).
auto fields = Object::create(realm, realm.intrinsics().object_prototype());
@ -459,7 +459,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::to_string)
{
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time = TRY(typed_this_object(vm));
// 3. Set options to ? GetOptionsObject(options).
auto* options = TRY(get_options_object(vm, vm.argument(0)));
@ -483,7 +483,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::to_locale_string)
{
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time = TRY(typed_this_object(vm));
// 3. Return ! TemporalTimeToString(temporalTime.[[ISOHour]], temporalTime.[[ISOMinute]], temporalTime.[[ISOSecond]], temporalTime.[[ISOMillisecond]], temporalTime.[[ISOMicrosecond]], temporalTime.[[ISONanosecond]], "auto").
auto string = MUST_OR_THROW_OOM(temporal_time_to_string(vm, temporal_time->iso_hour(), temporal_time->iso_minute(), temporal_time->iso_second(), temporal_time->iso_millisecond(), temporal_time->iso_microsecond(), temporal_time->iso_nanosecond(), "auto"sv));
@ -495,7 +495,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::to_json)
{
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime, [[InitializedTemporalTime]]).
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time = TRY(typed_this_object(vm));
// 3. Return ! TemporalTimeToString(temporalTime.[[ISOHour]], temporalTime.[[ISOMinute]], temporalTime.[[ISOSecond]], temporalTime.[[ISOMillisecond]], temporalTime.[[ISOMicrosecond]], temporalTime.[[ISONanosecond]], "auto").
auto string = MUST_OR_THROW_OOM(temporal_time_to_string(vm, temporal_time->iso_hour(), temporal_time->iso_minute(), temporal_time->iso_second(), temporal_time->iso_millisecond(), temporal_time->iso_microsecond(), temporal_time->iso_nanosecond(), "auto"sv));

View file

@ -64,7 +64,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::calendar_getter)
{
// 1. Let yearMonth be the this value.
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
auto* year_month = TRY(typed_this_object(vm));
auto year_month = TRY(typed_this_object(vm));
// 3. Return yearMonth.[[Calendar]].
return Value(&year_month->calendar());
@ -75,13 +75,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::year_getter)
{
// 1. Let yearMonth be the this value.
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
auto* year_month = TRY(typed_this_object(vm));
auto year_month = TRY(typed_this_object(vm));
// 3. Let calendar be yearMonth.[[Calendar]].
auto& calendar = year_month->calendar();
// 4. Return 𝔽(? CalendarYear(calendar, yearMonth)).
return Value(TRY(calendar_year(vm, calendar, *year_month)));
return Value(TRY(calendar_year(vm, calendar, year_month)));
}
// 9.3.5 get Temporal.PlainYearMonth.prototype.month, https://tc39.es/proposal-temporal/#sec-get-temporal.plainyearmonth.prototype.month
@ -89,13 +89,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::month_getter)
{
// 1. Let yearMonth be the this value.
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
auto* year_month = TRY(typed_this_object(vm));
auto year_month = TRY(typed_this_object(vm));
// 3. Let calendar be yearMonth.[[Calendar]].
auto& calendar = year_month->calendar();
// 4. Return 𝔽(? CalendarMonth(calendar, yearMonth)).
return Value(TRY(calendar_month(vm, calendar, *year_month)));
return Value(TRY(calendar_month(vm, calendar, year_month)));
}
// 9.3.6 get Temporal.PlainYearMonth.prototype.monthCode, https://tc39.es/proposal-temporal/#sec-get-temporal.plainyearmonth.prototype.monthCode
@ -103,13 +103,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::month_code_getter)
{
// 1. Let yearMonth be the this value.
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
auto* year_month = TRY(typed_this_object(vm));
auto year_month = TRY(typed_this_object(vm));
// 3. Let calendar be yearMonth.[[Calendar]].
auto& calendar = year_month->calendar();
// 4. Return ? CalendarMonthCode(calendar, yearMonth).
return PrimitiveString::create(vm, TRY(calendar_month_code(vm, calendar, *year_month)));
return PrimitiveString::create(vm, TRY(calendar_month_code(vm, calendar, year_month)));
}
// 9.3.7 get Temporal.PlainYearMonth.prototype.daysInYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plainyearmonth.prototype.daysinyear
@ -117,13 +117,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::days_in_year_getter)
{
// 1. Let yearMonth be the this value.
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
auto* year_month = TRY(typed_this_object(vm));
auto year_month = TRY(typed_this_object(vm));
// 3. Let calendar be yearMonth.[[Calendar]].
auto& calendar = year_month->calendar();
// 4. Return 𝔽(? CalendarDaysInYear(calendar, yearMonth)).
return 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
@ -131,13 +131,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::days_in_month_getter)
{
// 1. Let yearMonth be the this value.
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
auto* year_month = TRY(typed_this_object(vm));
auto year_month = TRY(typed_this_object(vm));
// 3. Let calendar be yearMonth.[[Calendar]].
auto& calendar = year_month->calendar();
// 4. Return 𝔽(? CalendarDaysInMonth(calendar, yearMonth)).
return 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
@ -145,13 +145,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::months_in_year_getter)
{
// 1. Let yearMonth be the this value.
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
auto* year_month = TRY(typed_this_object(vm));
auto year_month = TRY(typed_this_object(vm));
// 3. Let calendar be yearMonth.[[Calendar]].
auto& calendar = year_month->calendar();
// 4. Return 𝔽(? CalendarMonthsInYear(calendar, yearMonth)).
return 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
@ -159,13 +159,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::in_leap_year_getter)
{
// 1. Let yearMonth be the this value.
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
auto* year_month = TRY(typed_this_object(vm));
auto year_month = TRY(typed_this_object(vm));
// 3. Let calendar be yearMonth.[[Calendar]].
auto& calendar = year_month->calendar();
// 4. Return ? CalendarInLeapYear(calendar, yearMonth).
return Value(TRY(calendar_in_leap_year(vm, calendar, *year_month)));
return Value(TRY(calendar_in_leap_year(vm, calendar, year_month)));
}
// 15.6.9.2 get Temporal.PlainYearMonth.prototype.era, https://tc39.es/proposal-temporal/#sec-get-temporal.plainyearmonth.prototype.era
@ -173,13 +173,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::era_getter)
{
// 1. Let plainYearMonth be the this value.
// 2. Perform ? RequireInternalSlot(plainYearMonth, [[InitializedTemporalYearMonth]]).
auto* plain_year_month = TRY(typed_this_object(vm));
auto plain_year_month = TRY(typed_this_object(vm));
// 3. Let calendar be plainYearMonth.[[Calendar]].
auto& calendar = plain_year_month->calendar();
// 4. Return ? CalendarEra(calendar, plainYearMonth).
return TRY(calendar_era(vm, calendar, *plain_year_month));
return TRY(calendar_era(vm, calendar, plain_year_month));
}
// 15.6.9.3 get Temporal.PlainYearMonth.prototype.eraYear, https://tc39.es/proposal-temporal/#sec-get-temporal.plainyearmonth.prototype.erayear
@ -187,13 +187,13 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::era_year_getter)
{
// 1. Let plainYearMonth be the this value.
// 2. Perform ? RequireInternalSlot(plainYearMonth, [[InitializedTemporalYearMonth]]).
auto* plain_year_month = TRY(typed_this_object(vm));
auto plain_year_month = TRY(typed_this_object(vm));
// 3. Let calendar be plainYearMonth.[[Calendar]].
auto& calendar = plain_year_month->calendar();
// 4. Return ? CalendarEraYear(calendar, plainYearMonth).
return TRY(calendar_era_year(vm, calendar, *plain_year_month));
return TRY(calendar_era_year(vm, calendar, plain_year_month));
}
// 9.3.11 Temporal.PlainYearMonth.prototype.with ( temporalYearMonthLike [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype.with
@ -203,7 +203,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::with)
// 1. Let yearMonth be the this value.
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
auto* year_month = TRY(typed_this_object(vm));
auto year_month = TRY(typed_this_object(vm));
// 3. If Type(temporalYearMonthLike) is not Object, then
if (!temporal_year_month_like.is_object()) {
@ -227,7 +227,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::with)
auto* options = TRY(get_options_object(vm, vm.argument(1)));
// 9. Let fields be ? PrepareTemporalFields(yearMonth, fieldNames, «»).
auto* fields = TRY(prepare_temporal_fields(vm, *year_month, field_names, Vector<StringView> {}));
auto* fields = TRY(prepare_temporal_fields(vm, year_month, field_names, Vector<StringView> {}));
// 10. Set fields to ? CalendarMergeFields(calendar, fields, partialYearMonth).
fields = TRY(calendar_merge_fields(vm, calendar, *fields, *partial_year_month));
@ -247,10 +247,10 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::add)
// 1. Let yearMonth be the this value.
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
auto* year_month = TRY(typed_this_object(vm));
auto year_month = TRY(typed_this_object(vm));
// 3. Return ? AddDurationToOrSubtractDurationFromPlainYearMonth(add, yearMonth, temporalDurationLike, options).
return TRY(add_duration_to_or_subtract_duration_from_plain_year_month(vm, ArithmeticOperation::Add, *year_month, temporal_duration_like, options));
return TRY(add_duration_to_or_subtract_duration_from_plain_year_month(vm, ArithmeticOperation::Add, year_month, temporal_duration_like, options));
}
// 9.3.13 Temporal.PlainYearMonth.prototype.subtract ( temporalDurationLike [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype.subtract
@ -261,10 +261,10 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::subtract)
// 1. Let yearMonth be the this value.
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
auto* year_month = TRY(typed_this_object(vm));
auto year_month = TRY(typed_this_object(vm));
// 3. Return ? AddDurationToOrSubtractDurationFromPlainYearMonth(add, yearMonth, temporalDurationLike, options).
return TRY(add_duration_to_or_subtract_duration_from_plain_year_month(vm, ArithmeticOperation::Subtract, *year_month, temporal_duration_like, options));
return TRY(add_duration_to_or_subtract_duration_from_plain_year_month(vm, ArithmeticOperation::Subtract, year_month, temporal_duration_like, options));
}
// 9.3.14 Temporal.PlainYearMonth.prototype.until ( other [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype.until
@ -275,10 +275,10 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::until)
// 1. Let yearMonth be the this value.
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
auto* year_month = TRY(typed_this_object(vm));
auto year_month = TRY(typed_this_object(vm));
// 3. Return ? DifferenceTemporalPlainYearMonth(until, yearMonth, other, options).
return TRY(difference_temporal_plain_year_month(vm, DifferenceOperation::Until, *year_month, other, options));
return TRY(difference_temporal_plain_year_month(vm, DifferenceOperation::Until, year_month, other, options));
}
// 9.3.15 Temporal.PlainYearMonth.prototype.since ( other [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype.since
@ -289,10 +289,10 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::since)
// 1. Let yearMonth be the this value.
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
auto* year_month = TRY(typed_this_object(vm));
auto year_month = TRY(typed_this_object(vm));
// 3. Return ? DifferenceTemporalPlainYearMonth(since, yearMonth, other, options).
return TRY(difference_temporal_plain_year_month(vm, DifferenceOperation::Since, *year_month, other, options));
return TRY(difference_temporal_plain_year_month(vm, DifferenceOperation::Since, year_month, other, options));
}
// 9.3.16 Temporal.PlainYearMonth.prototype.equals ( other ), https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype.equals
@ -300,7 +300,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::equals)
{
// 1. Let yearMonth be the this value.
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
auto* year_month = TRY(typed_this_object(vm));
auto year_month = TRY(typed_this_object(vm));
// 3. Set other to ? ToTemporalYearMonth(other).
auto* other = TRY(to_temporal_year_month(vm, vm.argument(0)));
@ -326,7 +326,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::to_string)
{
// 1. Let yearMonth be the this value.
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
auto* year_month = TRY(typed_this_object(vm));
auto year_month = TRY(typed_this_object(vm));
// 3. Set options to ? GetOptionsObject(options).
auto* options = TRY(get_options_object(vm, vm.argument(0)));
@ -335,7 +335,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::to_string)
auto show_calendar = TRY(to_calendar_name_option(vm, *options));
// 5. Return ? TemporalYearMonthToString(yearMonth, showCalendar).
return PrimitiveString::create(vm, TRY(temporal_year_month_to_string(vm, *year_month, show_calendar)));
return PrimitiveString::create(vm, TRY(temporal_year_month_to_string(vm, year_month, show_calendar)));
}
// 9.3.18 Temporal.PlainYearMonth.prototype.toLocaleString ( [ locales [ , options ] ] ), https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype.tolocalestring
@ -344,10 +344,10 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::to_locale_string)
{
// 1. Let yearMonth be the this value.
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
auto* year_month = TRY(typed_this_object(vm));
auto year_month = TRY(typed_this_object(vm));
// 3. Return ? TemporalYearMonthToString(yearMonth, "auto").
return PrimitiveString::create(vm, TRY(temporal_year_month_to_string(vm, *year_month, "auto"sv)));
return PrimitiveString::create(vm, TRY(temporal_year_month_to_string(vm, year_month, "auto"sv)));
}
// 9.3.19 Temporal.PlainYearMonth.prototype.toJSON ( ), https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype.tojson
@ -355,10 +355,10 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::to_json)
{
// 1. Let yearMonth be the this value.
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
auto* year_month = TRY(typed_this_object(vm));
auto year_month = TRY(typed_this_object(vm));
// 3. Return ? TemporalYearMonthToString(yearMonth, "auto").
return PrimitiveString::create(vm, TRY(temporal_year_month_to_string(vm, *year_month, "auto"sv)));
return PrimitiveString::create(vm, TRY(temporal_year_month_to_string(vm, year_month, "auto"sv)));
}
// 9.3.20 Temporal.PlainYearMonth.prototype.valueOf ( ), https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype.valueof
@ -377,7 +377,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::to_plain_date)
// 1. Let yearMonth be the this value.
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
auto* year_month = TRY(typed_this_object(vm));
auto year_month = TRY(typed_this_object(vm));
// 3. If Type(item) is not Object, then
if (!item.is_object()) {
@ -392,7 +392,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::to_plain_date)
auto receiver_field_names = TRY(calendar_fields(vm, calendar, { "monthCode"sv, "year"sv }));
// 6. Let fields be ? PrepareTemporalFields(yearMonth, receiverFieldNames, «»).
auto* fields = TRY(prepare_temporal_fields(vm, *year_month, receiver_field_names, Vector<StringView> {}));
auto* fields = TRY(prepare_temporal_fields(vm, year_month, receiver_field_names, Vector<StringView> {}));
// 7. Let inputFieldNames be ? CalendarFields(calendar, « "day" »).
auto input_field_names = TRY(calendar_fields(vm, calendar, { "day"sv }));
@ -426,7 +426,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::get_iso_fields)
// 1. Let yearMonth be the this value.
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
auto* year_month = TRY(typed_this_object(vm));
auto year_month = TRY(typed_this_object(vm));
// 3. Let fields be OrdinaryObjectCreate(%Object.prototype%).
auto fields = Object::create(realm, realm.intrinsics().object_prototype());

View file

@ -52,7 +52,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::id_getter)
{
// 1. Let timeZone be the this value.
// 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimeZone]]).
auto* time_zone = TRY(typed_this_object(vm));
auto time_zone = TRY(typed_this_object(vm));
// 3. Return timeZone.[[Identifier]].
return PrimitiveString::create(vm, time_zone->identifier());
@ -63,7 +63,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::get_offset_nanoseconds_for)
{
// 1. Let timeZone be the this value.
// 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimeZone]]).
auto* time_zone = TRY(typed_this_object(vm));
auto time_zone = TRY(typed_this_object(vm));
// 3. Set instant to ? ToTemporalInstant(instant).
auto* instant = TRY(to_temporal_instant(vm, vm.argument(0)));
@ -81,7 +81,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::get_offset_string_for)
{
// 1. Let timeZone be the this value.
// 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimeZone]]).
auto* time_zone = TRY(typed_this_object(vm));
auto time_zone = TRY(typed_this_object(vm));
// 3. Set instant to ? ToTemporalInstant(instant).
auto* instant = TRY(to_temporal_instant(vm, vm.argument(0)));
@ -96,7 +96,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::get_plain_date_time_for)
{
// 1. Let timeZone be the this value.
// 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimeZone]]).
auto* time_zone = TRY(typed_this_object(vm));
auto time_zone = TRY(typed_this_object(vm));
// 3. Set instant to ? ToTemporalInstant(instant).
auto* instant = TRY(to_temporal_instant(vm, vm.argument(0)));
@ -113,7 +113,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::get_instant_for)
{
// 1. Let timeZone be the this value.
// 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimeZone]]).
auto* time_zone = TRY(typed_this_object(vm));
auto time_zone = TRY(typed_this_object(vm));
// 3. Set dateTime to ? ToTemporalDateTime(dateTime).
auto* date_time = TRY(to_temporal_date_time(vm, vm.argument(0)));
@ -135,7 +135,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::get_possible_instants_for)
// 1. Let timeZone be the this value.
// 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimezone]]).
auto* time_zone = TRY(typed_this_object(vm));
auto time_zone = TRY(typed_this_object(vm));
// 3. Set dateTime to ? ToTemporalDateTime(dateTime).
auto* date_time = TRY(to_temporal_date_time(vm, vm.argument(0)));
@ -182,7 +182,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::get_next_transition)
{
// 1. Let timeZone be the this value.
// 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimeZone]]).
auto* time_zone = TRY(typed_this_object(vm));
auto time_zone = TRY(typed_this_object(vm));
// 3. Set startingPoint to ? ToTemporalInstant(startingPoint).
auto* starting_point = TRY(to_temporal_instant(vm, vm.argument(0)));
@ -207,7 +207,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::get_previous_transition)
{
// 1. Let timeZone be the this value.
// 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimeZone]]).
auto* time_zone = TRY(typed_this_object(vm));
auto time_zone = TRY(typed_this_object(vm));
// 3. Set startingPoint to ? ToTemporalInstant(startingPoint).
auto* starting_point = TRY(to_temporal_instant(vm, vm.argument(0)));
@ -232,7 +232,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::to_string)
{
// 1. Let timeZone be the this value.
// 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimeZone]]).
auto* time_zone = TRY(typed_this_object(vm));
auto time_zone = TRY(typed_this_object(vm));
// 3. Return timeZone.[[Identifier]].
return PrimitiveString::create(vm, time_zone->identifier());
@ -243,7 +243,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::to_json)
{
// 1. Let timeZone be the this value.
// 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimeZone]]).
auto* time_zone = TRY(typed_this_object(vm));
auto time_zone = TRY(typed_this_object(vm));
// 3. Return ? ToString(timeZone).
return PrimitiveString::create(vm, TRY(Value(time_zone).to_string(vm)));

View file

@ -99,7 +99,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::calendar_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Return zonedDateTime.[[Calendar]].
return Value(&zoned_date_time->calendar());
@ -110,7 +110,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::time_zone_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Return zonedDateTime.[[TimeZone]].
return Value(&zoned_date_time->time_zone());
@ -121,7 +121,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::year_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -144,7 +144,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::month_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -167,7 +167,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::month_code_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -190,7 +190,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::day_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -213,7 +213,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::hour_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -236,7 +236,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::minute_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -259,7 +259,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::second_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -282,7 +282,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::millisecond_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -305,7 +305,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::microsecond_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -328,7 +328,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::nanosecond_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -351,7 +351,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::epoch_seconds_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let ns be zonedDateTime.[[Nanoseconds]].
auto& ns = zoned_date_time->nanoseconds();
@ -368,7 +368,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::epoch_milliseconds_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let ns be zonedDateTime.[[Nanoseconds]].
auto& ns = zoned_date_time->nanoseconds();
@ -385,7 +385,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::epoch_microseconds_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let ns be zonedDateTime.[[Nanoseconds]].
auto& ns = zoned_date_time->nanoseconds();
@ -402,7 +402,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::epoch_nanoseconds_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Return zonedDateTime.[[Nanoseconds]].
return &zoned_date_time->nanoseconds();
@ -413,7 +413,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::day_of_week_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -436,7 +436,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::day_of_year_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -459,7 +459,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::week_of_year_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -482,7 +482,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::year_of_week_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -505,7 +505,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::hours_in_day_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -556,7 +556,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::days_in_week_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -579,7 +579,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::days_in_month_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -602,7 +602,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::days_in_year_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -625,7 +625,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::months_in_year_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -648,7 +648,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::in_leap_year_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -671,7 +671,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::offset_nanoseconds_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -688,7 +688,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::offset_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let instant be ! CreateTemporalInstant(zonedDateTime.[[Nanoseconds]]).
auto* instant = MUST(create_temporal_instant(vm, zoned_date_time->nanoseconds()));
@ -703,7 +703,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::era_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -726,7 +726,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::era_year_getter)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -751,7 +751,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::with)
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. If Type(temporalZonedDateTimeLike) is not Object, then
if (!temporal_zoned_date_time_like.is_object()) {
@ -790,7 +790,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::with)
field_names.append(TRY_OR_THROW_OOM(vm, "timeZone"_string));
// 14. Let fields be ? PrepareTemporalFields(zonedDateTime, fieldNames, « "timeZone", "offset" »).
auto* fields = TRY(prepare_temporal_fields(vm, *zoned_date_time, field_names, Vector<StringView> { "timeZone"sv, "offset"sv }));
auto* fields = TRY(prepare_temporal_fields(vm, zoned_date_time, field_names, Vector<StringView> { "timeZone"sv, "offset"sv }));
// 15. Set fields to ? CalendarMergeFields(calendar, fields, partialZonedDateTime).
fields = TRY(calendar_merge_fields(vm, calendar, *fields, *partial_zoned_date_time));
@ -827,7 +827,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::with_plain_time)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
PlainTime* plain_time = nullptr;
@ -869,7 +869,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::with_plain_date)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let plainDate be ? ToTemporalDate(plainDateLike).
auto* plain_date = TRY(to_temporal_date(vm, vm.argument(0)));
@ -901,7 +901,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::with_time_zone)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be ? ToTemporalTimeZone(timeZoneLike).
auto* time_zone = TRY(to_temporal_time_zone(vm, vm.argument(0)));
@ -915,7 +915,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::with_calendar)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let calendar be ? ToTemporalCalendar(calendarLike).
auto* calendar = TRY(to_temporal_calendar(vm, vm.argument(0)));
@ -932,10 +932,10 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::add)
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Return ? AddDurationToOrSubtractDurationFromZonedDateTime(add, zonedDateTime, temporalDurationLike, options).
return TRY(add_duration_to_or_subtract_duration_from_zoned_date_time(vm, ArithmeticOperation::Add, *zoned_date_time, temporal_duration_like, options));
return TRY(add_duration_to_or_subtract_duration_from_zoned_date_time(vm, ArithmeticOperation::Add, zoned_date_time, temporal_duration_like, options));
}
// 6.3.37 Temporal.ZonedDateTime.prototype.subtract ( temporalDurationLike [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.subtract
@ -946,10 +946,10 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::subtract)
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Return ? AddDurationToOrSubtractDurationFromZonedDateTime(subtract, zonedDateTime, temporalDurationLike, options).
return TRY(add_duration_to_or_subtract_duration_from_zoned_date_time(vm, ArithmeticOperation::Subtract, *zoned_date_time, temporal_duration_like, options));
return TRY(add_duration_to_or_subtract_duration_from_zoned_date_time(vm, ArithmeticOperation::Subtract, zoned_date_time, temporal_duration_like, options));
}
// 6.3.38 Temporal.ZonedDateTime.prototype.until ( other [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.until
@ -960,10 +960,10 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::until)
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Return ? DifferenceTemporalZonedDateTime(until, zonedDateTime, other, options).
return TRY(difference_temporal_zoned_date_time(vm, DifferenceOperation::Until, *zoned_date_time, other, options));
return TRY(difference_temporal_zoned_date_time(vm, DifferenceOperation::Until, zoned_date_time, other, options));
}
// 6.3.39 Temporal.ZonedDateTime.prototype.since ( other [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.since
@ -974,10 +974,10 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::since)
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Return ? DifferenceTemporalZonedDateTime(since, zonedDateTime, other, options).
return TRY(difference_temporal_zoned_date_time(vm, DifferenceOperation::Since, *zoned_date_time, other, options));
return TRY(difference_temporal_zoned_date_time(vm, DifferenceOperation::Since, zoned_date_time, other, options));
}
// 6.3.40 Temporal.ZonedDateTime.prototype.round ( roundTo ), https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.round
@ -987,7 +987,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::round)
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. If roundTo is undefined, then
if (vm.argument(0).is_undefined()) {
@ -1076,7 +1076,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::equals)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Set other to ? ToTemporalZonedDateTime(other).
auto* other = TRY(to_temporal_zoned_date_time(vm, vm.argument(0)));
@ -1098,7 +1098,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_string)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Set options to ? GetOptionsObject(options).
auto* options = TRY(get_options_object(vm, vm.argument(0)));
@ -1119,7 +1119,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_string)
auto show_offset = TRY(to_show_offset_option(vm, *options));
// 9. Return ? TemporalZonedDateTimeToString(zonedDateTime, precision.[[Precision]], showCalendar, showTimeZone, showOffset, precision.[[Increment]], precision.[[Unit]], roundingMode).
return PrimitiveString::create(vm, TRY(temporal_zoned_date_time_to_string(vm, *zoned_date_time, precision.precision, show_calendar, show_time_zone, show_offset, precision.increment, precision.unit, rounding_mode)));
return PrimitiveString::create(vm, TRY(temporal_zoned_date_time_to_string(vm, zoned_date_time, precision.precision, show_calendar, show_time_zone, show_offset, precision.increment, precision.unit, rounding_mode)));
}
// 6.3.43 Temporal.ZonedDateTime.prototype.toLocaleString ( [ locales [ , options ] ] ), https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.tolocalestring
@ -1128,10 +1128,10 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_locale_string)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Return ? TemporalZonedDateTimeToString(zonedDateTime, "auto", "auto", "auto", "auto").
return PrimitiveString::create(vm, TRY(temporal_zoned_date_time_to_string(vm, *zoned_date_time, "auto"sv, "auto"sv, "auto"sv, "auto"sv)));
return PrimitiveString::create(vm, TRY(temporal_zoned_date_time_to_string(vm, zoned_date_time, "auto"sv, "auto"sv, "auto"sv, "auto"sv)));
}
// 6.3.44 Temporal.ZonedDateTime.prototype.toJSON ( ), https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.tojson
@ -1139,10 +1139,10 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_json)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Return ? TemporalZonedDateTimeToString(zonedDateTime, "auto", "auto", "auto", "auto").
return PrimitiveString::create(vm, TRY(temporal_zoned_date_time_to_string(vm, *zoned_date_time, "auto"sv, "auto"sv, "auto"sv, "auto"sv)));
return PrimitiveString::create(vm, TRY(temporal_zoned_date_time_to_string(vm, zoned_date_time, "auto"sv, "auto"sv, "auto"sv, "auto"sv)));
}
// 6.3.45 Temporal.ZonedDateTime.prototype.valueOf ( ), https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.valueof
@ -1157,7 +1157,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::start_of_day)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -1186,7 +1186,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_instant)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Return ! CreateTemporalInstant(zonedDateTime.[[Nanoseconds]]).
return MUST(create_temporal_instant(vm, zoned_date_time->nanoseconds()));
@ -1197,7 +1197,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_plain_date)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -1220,7 +1220,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_plain_time)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -1243,7 +1243,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_plain_date_time)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -1260,7 +1260,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_plain_year_month)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -1289,7 +1289,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_plain_month_day)
{
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -1320,7 +1320,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::get_iso_fields)
// 1. Let zonedDateTime be the this value.
// 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]).
auto* zoned_date_time = TRY(typed_this_object(vm));
auto zoned_date_time = TRY(typed_this_object(vm));
// 3. Let fields be OrdinaryObjectCreate(%Object.prototype%).
auto fields = Object::create(realm, realm.intrinsics().object_prototype());