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

LibJS: Replace GlobalObject with VM in PrototypeObject AOs [Part 3/19]

This commit is contained in:
Linus Groh 2022-08-20 22:42:08 +01:00
parent 694f66b5ca
commit f6c4a0f5d0
44 changed files with 392 additions and 394 deletions

View file

@ -67,7 +67,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(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Return ? ToString(calendar).
return { js_string(vm, TRY(Value(calendar).to_string(global_object))) };
@ -79,7 +79,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(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -105,7 +105,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(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -131,7 +131,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(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -157,7 +157,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(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -191,7 +191,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(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -225,7 +225,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(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -247,7 +247,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(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -276,7 +276,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(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -298,7 +298,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(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -320,7 +320,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(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -351,7 +351,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(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -375,7 +375,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(global_object));
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::days_in_week)
{
// 1. Let calendar be the this value.
// 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
auto* calendar = TRY(typed_this_object(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -411,7 +411,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(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -433,7 +433,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(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -455,7 +455,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(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -477,7 +477,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(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -507,7 +507,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(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Assert: calendar.[[Identifier]] is "iso8601".
VERIFY(calendar->identifier() == "iso8601"sv);
@ -572,7 +572,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(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Set fields to ? ToObject(fields).
auto* fields = TRY(vm.argument(0).to_object(global_object));
@ -592,7 +592,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(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Return calendar.[[Identifier]].
return js_string(vm, calendar->identifier());
@ -603,7 +603,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(global_object));
auto* calendar = TRY(typed_this_object(vm));
// 3. Return ? ToString(calendar).
return js_string(vm, TRY(Value(calendar).to_string(global_object)));
@ -616,7 +616,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(global_object));
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()))) {
@ -644,7 +644,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(global_object));
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

@ -61,7 +61,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(global_object));
auto* duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(duration.[[Years]]).
return Value(duration->years());
@ -72,7 +72,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(global_object));
auto* duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(duration.[[Months]]).
return Value(duration->months());
@ -83,7 +83,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(global_object));
auto* duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(duration.[[Weeks]]).
return Value(duration->weeks());
@ -94,7 +94,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(global_object));
auto* duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(duration.[[Days]]).
return Value(duration->days());
@ -105,7 +105,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(global_object));
auto* duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(duration.[[Hours]]).
return Value(duration->hours());
@ -116,7 +116,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(global_object));
auto* duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(duration.[[Minutes]]).
return Value(duration->minutes());
@ -127,7 +127,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(global_object));
auto* duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(duration.[[Seconds]]).
return Value(duration->seconds());
@ -138,7 +138,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(global_object));
auto* duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(duration.[[Milliseconds]]).
return Value(duration->milliseconds());
@ -149,7 +149,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(global_object));
auto* duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(duration.[[Microseconds]]).
return Value(duration->microseconds());
@ -160,7 +160,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(global_object));
auto* duration = TRY(typed_this_object(vm));
// 3. Return 𝔽(duration.[[Nanoseconds]]).
return Value(duration->nanoseconds());
@ -171,7 +171,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(global_object));
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()));
@ -182,7 +182,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(global_object));
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());
@ -200,7 +200,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(global_object));
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)));
@ -274,7 +274,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::negated)
{
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(global_object));
auto* duration = TRY(typed_this_object(vm));
// 3. Return ! CreateNegatedTemporalDuration(duration).
return create_negated_temporal_duration(vm, *duration);
@ -285,7 +285,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(global_object));
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())));
@ -299,7 +299,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::add)
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(global_object));
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));
@ -313,7 +313,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::subtract)
// 1. Let duration be the this value.
// 2. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration = TRY(typed_this_object(global_object));
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));
@ -326,7 +326,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(global_object));
auto* duration = TRY(typed_this_object(vm));
// 3. If roundTo is undefined, then
if (vm.argument(0).is_undefined()) {
@ -450,7 +450,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(global_object));
auto* duration = TRY(typed_this_object(vm));
// 3. If totalOf is undefined, throw a TypeError exception.
if (vm.argument(0).is_undefined())
@ -568,7 +568,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(global_object));
auto* duration = TRY(typed_this_object(vm));
// 3. Set options to ? GetOptionsObject(options).
auto const* options = TRY(get_options_object(vm, vm.argument(0)));
@ -595,7 +595,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(global_object));
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 js_string(vm, temporal_duration_to_string(duration->years(), duration->months(), duration->weeks(), duration->days(), duration->hours(), duration->minutes(), duration->seconds(), duration->milliseconds(), duration->microseconds(), duration->nanoseconds(), "auto"sv));
@ -607,7 +607,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(global_object));
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 js_string(vm, temporal_duration_to_string(duration->years(), duration->months(), duration->weeks(), duration->days(), duration->hours(), duration->minutes(), duration->seconds(), duration->milliseconds(), duration->microseconds(), duration->nanoseconds(), "auto"sv));

View file

@ -58,7 +58,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(global_object));
auto* instant = TRY(typed_this_object(vm));
// 3. Let ns be instant.[[Nanoseconds]].
auto& ns = instant->nanoseconds();
@ -75,7 +75,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(global_object));
auto* instant = TRY(typed_this_object(vm));
// 3. Let ns be instant.[[Nanoseconds]].
auto& ns = instant->nanoseconds();
@ -92,7 +92,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(global_object));
auto* instant = TRY(typed_this_object(vm));
// 3. Let ns be instant.[[Nanoseconds]].
auto& ns = instant->nanoseconds();
@ -109,7 +109,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(global_object));
auto* instant = TRY(typed_this_object(vm));
// 3. Let ns be instant.[[Nanoseconds]].
auto& ns = instant->nanoseconds();
@ -125,7 +125,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::add)
// 1. Let instant be the this value.
// 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
auto* instant = TRY(typed_this_object(global_object));
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));
@ -138,7 +138,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::subtract)
// 1. Let instant be the this value.
// 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
auto* instant = TRY(typed_this_object(global_object));
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));
@ -152,7 +152,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::until)
// 1. Let instant be the this value.
// 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
auto* instant = TRY(typed_this_object(global_object));
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));
@ -166,7 +166,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::since)
// 1. Let instant be the this value.
// 2. Perform ? RequireInternalSlot(instant, [[InitializedTemporalInstant]]).
auto* instant = TRY(typed_this_object(global_object));
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));
@ -179,7 +179,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(global_object));
auto* instant = TRY(typed_this_object(vm));
// 3. If roundTo is undefined, then
if (vm.argument(0).is_undefined()) {
@ -267,7 +267,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(global_object));
auto* instant = TRY(typed_this_object(vm));
// 3. Set other to ? ToTemporalInstant(other).
auto other = TRY(to_temporal_instant(vm, vm.argument(0)));
@ -285,7 +285,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(global_object));
auto* instant = TRY(typed_this_object(vm));
// 3. Set options to ? GetOptionsObject(options).
auto const* options = TRY(get_options_object(vm, vm.argument(0)));
@ -321,7 +321,7 @@ 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(global_object));
auto* instant = TRY(typed_this_object(vm));
// 3. Return ? TemporalInstantToString(instant, undefined, "auto").
return js_string(vm, TRY(temporal_instant_to_string(vm, *instant, js_undefined(), "auto"sv)));
@ -332,7 +332,7 @@ 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(global_object));
auto* instant = TRY(typed_this_object(vm));
// 3. Return ? TemporalInstantToString(instant, undefined, "auto").
return js_string(vm, TRY(temporal_instant_to_string(vm, *instant, js_undefined(), "auto"sv)));
@ -352,7 +352,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(global_object));
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(global_object));
auto* instant = TRY(typed_this_object(vm));
// 3. If Type(item) is Object, then
if (item.is_object()) {

View file

@ -74,7 +74,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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Return temporalDate.[[Calendar]].
return Value(&temporal_date->calendar());
@ -85,7 +85,7 @@ 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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
@ -99,7 +99,7 @@ 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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
@ -113,7 +113,7 @@ 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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
@ -127,7 +127,7 @@ 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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
@ -141,7 +141,7 @@ 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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
@ -155,7 +155,7 @@ 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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
@ -169,7 +169,7 @@ 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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
@ -183,7 +183,7 @@ 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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
@ -197,7 +197,7 @@ 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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
@ -211,7 +211,7 @@ 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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
@ -225,7 +225,7 @@ 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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
@ -239,7 +239,7 @@ 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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
@ -253,7 +253,7 @@ 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(global_object));
auto* plain_date = TRY(typed_this_object(vm));
// 3. Let calendar be plainDate.[[Calendar]].
auto& calendar = plain_date->calendar();
@ -267,7 +267,7 @@ 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(global_object));
auto* plain_date = TRY(typed_this_object(vm));
// 3. Let calendar be plainDate.[[Calendar]].
auto& calendar = plain_date->calendar();
@ -281,7 +281,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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
@ -301,7 +301,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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be temporalDate.[[Calendar]].
auto& calendar = temporal_date->calendar();
@ -323,7 +323,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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Let fields be OrdinaryObjectCreate(%Object.prototype%).
auto* fields = Object::create(realm, global_object.object_prototype());
@ -349,7 +349,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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Let duration be ? ToTemporalDuration(temporalDurationLike).
auto* duration = TRY(to_temporal_duration(vm, vm.argument(0)));
@ -366,7 +366,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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Let duration be ? ToTemporalDuration(temporalDurationLike).
auto* duration = TRY(to_temporal_duration(vm, vm.argument(0)));
@ -388,7 +388,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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. If Type(temporalDateLike) is not Object, then
if (!temporal_date_like.is_object()) {
@ -431,7 +431,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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Let calendar be ? ToTemporalCalendar(calendarLike).
auto* calendar = TRY(to_temporal_calendar(vm, calendar_like));
@ -448,7 +448,7 @@ 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(global_object));
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));
@ -462,7 +462,7 @@ 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(global_object));
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));
@ -473,7 +473,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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Set other to ? ToTemporalDate(other).
auto* other = TRY(to_temporal_date(vm, vm.argument(0)));
@ -496,7 +496,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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. If temporalTime is undefined, then
if (vm.argument(0).is_undefined()) {
@ -518,7 +518,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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
auto temporal_time_value = js_undefined();
Object* time_zone;
@ -580,7 +580,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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Set options to ? GetOptionsObject(options).
auto* options = TRY(get_options_object(vm, vm.argument(0)));
@ -598,7 +598,7 @@ 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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Return ? TemporalDateToString(temporalDate, "auto").
return js_string(vm, TRY(temporal_date_to_string(vm, *temporal_date, "auto"sv)));
@ -609,7 +609,7 @@ 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(global_object));
auto* temporal_date = TRY(typed_this_object(vm));
// 3. Return ? TemporalDateToString(temporalDate, "auto").
return js_string(vm, TRY(temporal_date_to_string(vm, *temporal_date, "auto"sv)));

View file

@ -85,7 +85,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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Return dateTime.[[Calendar]].
return Value(&date_time->calendar());
@ -96,7 +96,7 @@ 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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
@ -110,7 +110,7 @@ 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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
@ -124,7 +124,7 @@ 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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
@ -138,7 +138,7 @@ 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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
@ -152,7 +152,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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(dateTime.[[ISOHour]]).
return Value(date_time->iso_hour());
@ -163,7 +163,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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(dateTime.[[ISOMinute]]).
return Value(date_time->iso_minute());
@ -174,7 +174,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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(dateTime.[[ISOSecond]]).
return Value(date_time->iso_second());
@ -185,7 +185,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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(dateTime.[[ISOMillisecond]]).
return Value(date_time->iso_millisecond());
@ -196,7 +196,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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(dateTime.[[ISOMicrosecond]]).
return Value(date_time->iso_microsecond());
@ -207,7 +207,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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(dateTime.[[ISONanosecond]]).
return Value(date_time->iso_nanosecond());
@ -218,7 +218,7 @@ 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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
@ -232,7 +232,7 @@ 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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
@ -246,7 +246,7 @@ 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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
@ -260,7 +260,7 @@ 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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
@ -274,7 +274,7 @@ 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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
@ -288,7 +288,7 @@ 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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
@ -302,7 +302,7 @@ 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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
@ -316,7 +316,7 @@ 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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
@ -330,7 +330,7 @@ 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(global_object));
auto* plain_date_time = TRY(typed_this_object(vm));
// 3. Let calendar be plainDateTime.[[Calendar]].
auto& calendar = plain_date_time->calendar();
@ -344,7 +344,7 @@ 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(global_object));
auto* plain_date_time = TRY(typed_this_object(vm));
// 3. Let calendar be plainDateTime.[[Calendar]].
auto& calendar = plain_date_time->calendar();
@ -360,7 +360,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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. If Type(temporalDateTimeLike) is not Object, then
if (!temporal_date_time_like.is_object()) {
@ -410,7 +410,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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. If plainTimeLike is undefined, then
if (vm.argument(0).is_undefined()) {
@ -430,7 +430,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(global_object));
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)));
@ -449,7 +449,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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Let calendar be ? ToTemporalCalendar(calendarLike).
auto* calendar = TRY(to_temporal_calendar(vm, calendar_like));
@ -466,7 +466,7 @@ 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(global_object));
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));
@ -480,7 +480,7 @@ 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(global_object));
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));
@ -494,7 +494,7 @@ 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(global_object));
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));
@ -508,7 +508,7 @@ 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(global_object));
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));
@ -521,7 +521,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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. If roundTo is undefined, then
if (vm.argument(0).is_undefined()) {
@ -568,7 +568,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(global_object));
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)));
@ -589,7 +589,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(global_object));
auto* date_time = 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(PlainDateTimePrototype::to_locale_string)
{
// 1. Let dateTime be the this value.
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
auto* date_time = TRY(typed_this_object(global_object));
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 js_string(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)));
@ -627,7 +627,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(global_object));
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 js_string(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)));
@ -645,7 +645,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(global_object));
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)));
@ -668,7 +668,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(global_object));
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()));
@ -679,7 +679,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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
@ -699,7 +699,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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Let calendar be dateTime.[[Calendar]].
auto& calendar = date_time->calendar();
@ -719,7 +719,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(global_object));
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()));
@ -732,7 +732,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(global_object));
auto* date_time = TRY(typed_this_object(vm));
// 3. Let fields be OrdinaryObjectCreate(%Object.prototype%).
auto* fields = Object::create(realm, global_object.object_prototype());

View file

@ -49,7 +49,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(global_object));
auto* month_day = TRY(typed_this_object(vm));
// 3. Return monthDay.[[Calendar]].
return Value(&month_day->calendar());
@ -60,7 +60,7 @@ 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(global_object));
auto* month_day = TRY(typed_this_object(vm));
// 3. Let calendar be monthDay.[[Calendar]].
auto& calendar = month_day->calendar();
@ -74,7 +74,7 @@ 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(global_object));
auto* month_day = TRY(typed_this_object(vm));
// 3. Let calendar be monthDay.[[Calendar]].
auto& calendar = month_day->calendar();
@ -90,7 +90,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(global_object));
auto* month_day = TRY(typed_this_object(vm));
// 3. If Type(temporalMonthDayLike) is not Object, then
if (!temporal_month_day_like.is_object()) {
@ -131,7 +131,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(global_object));
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)));
@ -157,7 +157,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(global_object));
auto* month_day = TRY(typed_this_object(vm));
// 3. Set options to ? GetOptionsObject(options).
auto* options = TRY(get_options_object(vm, vm.argument(0)));
@ -175,7 +175,7 @@ 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(global_object));
auto* month_day = TRY(typed_this_object(vm));
// 3. Return ? TemporalMonthDayToString(monthDay, "auto").
return js_string(vm, TRY(temporal_month_day_to_string(vm, *month_day, "auto"sv)));
@ -186,7 +186,7 @@ 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(global_object));
auto* month_day = TRY(typed_this_object(vm));
// 3. Return ? TemporalMonthDayToString(monthDay, "auto").
return js_string(vm, TRY(temporal_month_day_to_string(vm, *month_day, "auto"sv)));
@ -208,7 +208,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(global_object));
auto* month_day = TRY(typed_this_object(vm));
// 3. If Type(item) is not Object, then
if (!item.is_object()) {
@ -257,7 +257,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(global_object));
auto* month_day = TRY(typed_this_object(vm));
// 3. Let fields be OrdinaryObjectCreate(%Object.prototype%).
auto* fields = Object::create(realm, global_object.object_prototype());

View file

@ -64,7 +64,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(global_object));
auto* temporal_time = TRY(typed_this_object(vm));
// 3. Return temporalTime.[[Calendar]].
return Value(&temporal_time->calendar());
@ -75,7 +75,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(global_object));
auto* temporal_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(temporalTime.[[ISOHour]]).
return Value(temporal_time->iso_hour());
@ -86,7 +86,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(global_object));
auto* temporal_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(temporalTime.[[ISOMinute]]).
return Value(temporal_time->iso_minute());
@ -97,7 +97,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(global_object));
auto* temporal_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(temporalTime.[[ISOSecond]]).
return Value(temporal_time->iso_second());
@ -108,7 +108,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(global_object));
auto* temporal_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(temporalTime.[[ISOMillisecond]]).
return Value(temporal_time->iso_millisecond());
@ -119,7 +119,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(global_object));
auto* temporal_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(temporalTime.[[ISOMicrosecond]]).
return Value(temporal_time->iso_microsecond());
@ -130,7 +130,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(global_object));
auto* temporal_time = TRY(typed_this_object(vm));
// 3. Return 𝔽(temporalTime.[[ISONanosecond]]).
return Value(temporal_time->iso_nanosecond());
@ -143,7 +143,7 @@ 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(global_object));
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));
@ -156,7 +156,7 @@ 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(global_object));
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));
@ -167,7 +167,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(global_object));
auto* temporal_time = TRY(typed_this_object(vm));
auto temporal_time_like_argument = vm.argument(0);
@ -242,7 +242,7 @@ 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(global_object));
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));
@ -256,7 +256,7 @@ 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(global_object));
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));
@ -269,7 +269,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(global_object));
auto* temporal_time = TRY(typed_this_object(vm));
// 3. If roundTo is undefined, then
if (vm.argument(0).is_undefined()) {
@ -319,7 +319,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(global_object));
auto* temporal_time = TRY(typed_this_object(vm));
// 3. Set other to ? ToTemporalTime(other).
auto* other = TRY(to_temporal_time(vm, vm.argument(0)));
@ -357,7 +357,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(global_object));
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)));
@ -373,7 +373,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(global_object));
auto* temporal_time = TRY(typed_this_object(vm));
// 3. If Type(item) is not Object, then
if (!item.is_object()) {
@ -422,7 +422,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(global_object));
auto* temporal_time = TRY(typed_this_object(vm));
// 3. Let fields be OrdinaryObjectCreate(%Object.prototype%).
auto* fields = Object::create(realm, global_object.object_prototype());
@ -457,7 +457,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(global_object));
auto* temporal_time = TRY(typed_this_object(vm));
// 3. Set options to ? GetOptionsObject(options).
auto* options = TRY(get_options_object(vm, vm.argument(0)));
@ -481,7 +481,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(global_object));
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 = temporal_time_to_string(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);
@ -493,7 +493,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(global_object));
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 = temporal_time_to_string(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

@ -62,7 +62,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(global_object));
auto* year_month = TRY(typed_this_object(vm));
// 3. Return yearMonth.[[Calendar]].
return Value(&year_month->calendar());
@ -73,7 +73,7 @@ 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(global_object));
auto* year_month = TRY(typed_this_object(vm));
// 3. Let calendar be yearMonth.[[Calendar]].
auto& calendar = year_month->calendar();
@ -87,7 +87,7 @@ 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(global_object));
auto* year_month = TRY(typed_this_object(vm));
// 3. Let calendar be yearMonth.[[Calendar]].
auto& calendar = year_month->calendar();
@ -101,7 +101,7 @@ 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(global_object));
auto* year_month = TRY(typed_this_object(vm));
// 3. Let calendar be yearMonth.[[Calendar]].
auto& calendar = year_month->calendar();
@ -115,7 +115,7 @@ 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(global_object));
auto* year_month = TRY(typed_this_object(vm));
// 3. Let calendar be yearMonth.[[Calendar]].
auto& calendar = year_month->calendar();
@ -129,7 +129,7 @@ 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(global_object));
auto* year_month = TRY(typed_this_object(vm));
// 3. Let calendar be yearMonth.[[Calendar]].
auto& calendar = year_month->calendar();
@ -143,7 +143,7 @@ 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(global_object));
auto* year_month = TRY(typed_this_object(vm));
// 3. Let calendar be yearMonth.[[Calendar]].
auto& calendar = year_month->calendar();
@ -157,7 +157,7 @@ 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(global_object));
auto* year_month = TRY(typed_this_object(vm));
// 3. Let calendar be yearMonth.[[Calendar]].
auto& calendar = year_month->calendar();
@ -171,7 +171,7 @@ 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(global_object));
auto* plain_year_month = TRY(typed_this_object(vm));
// 3. Let calendar be plainYearMonth.[[Calendar]].
auto& calendar = plain_year_month->calendar();
@ -185,7 +185,7 @@ 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(global_object));
auto* plain_year_month = TRY(typed_this_object(vm));
// 3. Let calendar be plainYearMonth.[[Calendar]].
auto& calendar = plain_year_month->calendar();
@ -201,7 +201,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(global_object));
auto* year_month = TRY(typed_this_object(vm));
// 3. If Type(temporalYearMonthLike) is not Object, then
if (!temporal_year_month_like.is_object()) {
@ -245,7 +245,7 @@ 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(global_object));
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));
@ -259,7 +259,7 @@ 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(global_object));
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));
@ -273,7 +273,7 @@ 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(global_object));
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));
@ -287,7 +287,7 @@ 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(global_object));
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));
@ -298,7 +298,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(global_object));
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)));
@ -324,7 +324,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(global_object));
auto* year_month = TRY(typed_this_object(vm));
// 3. Set options to ? GetOptionsObject(options).
auto* options = TRY(get_options_object(vm, vm.argument(0)));
@ -342,7 +342,7 @@ 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(global_object));
auto* year_month = TRY(typed_this_object(vm));
// 3. Return ? TemporalYearMonthToString(yearMonth, "auto").
return js_string(vm, TRY(temporal_year_month_to_string(vm, *year_month, "auto"sv)));
@ -353,7 +353,7 @@ 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(global_object));
auto* year_month = TRY(typed_this_object(vm));
// 3. Return ? TemporalYearMonthToString(yearMonth, "auto").
return js_string(vm, TRY(temporal_year_month_to_string(vm, *year_month, "auto"sv)));
@ -375,7 +375,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(global_object));
auto* year_month = 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(PlainYearMonthPrototype::get_iso_fields)
// 1. Let yearMonth be the this value.
// 2. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]).
auto* year_month = TRY(typed_this_object(global_object));
auto* year_month = TRY(typed_this_object(vm));
// 3. Let fields be OrdinaryObjectCreate(%Object.prototype%).
auto* fields = Object::create(realm, global_object.object_prototype());

View file

@ -49,7 +49,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(global_object));
auto* time_zone = TRY(typed_this_object(vm));
// 3. Return ? ToString(timeZone).
return js_string(vm, TRY(Value(time_zone).to_string(global_object)));
@ -60,7 +60,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(global_object));
auto* time_zone = TRY(typed_this_object(vm));
// 3. Set instant to ? ToTemporalInstant(instant).
auto* instant = TRY(to_temporal_instant(vm, vm.argument(0)));
@ -78,7 +78,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(global_object));
auto* time_zone = TRY(typed_this_object(vm));
// 3. Set instant to ? ToTemporalInstant(instant).
auto* instant = TRY(to_temporal_instant(vm, vm.argument(0)));
@ -93,7 +93,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(global_object));
auto* time_zone = TRY(typed_this_object(vm));
// 3. Set instant to ? ToTemporalInstant(instant).
auto* instant = TRY(to_temporal_instant(vm, vm.argument(0)));
@ -110,7 +110,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(global_object));
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)));
@ -132,7 +132,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(global_object));
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)));
@ -179,7 +179,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(global_object));
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)));
@ -204,7 +204,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(global_object));
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)));
@ -229,7 +229,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(global_object));
auto* time_zone = TRY(typed_this_object(vm));
// 3. Return timeZone.[[Identifier]].
return js_string(vm, time_zone->identifier());
@ -240,7 +240,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(global_object));
auto* time_zone = TRY(typed_this_object(vm));
// 3. Return ? ToString(timeZone).
return js_string(vm, TRY(Value(time_zone).to_string(global_object)));

View file

@ -95,7 +95,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Return zonedDateTime.[[Calendar]].
return Value(&zoned_date_time->calendar());
@ -106,7 +106,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Return zonedDateTime.[[TimeZone]].
return Value(&zoned_date_time->time_zone());
@ -117,7 +117,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -140,7 +140,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -163,7 +163,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -186,7 +186,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -209,7 +209,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -232,7 +232,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -255,7 +255,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -278,7 +278,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -301,7 +301,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -324,7 +324,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -347,7 +347,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let ns be zonedDateTime.[[Nanoseconds]].
auto& ns = zoned_date_time->nanoseconds();
@ -364,7 +364,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let ns be zonedDateTime.[[Nanoseconds]].
auto& ns = zoned_date_time->nanoseconds();
@ -381,7 +381,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let ns be zonedDateTime.[[Nanoseconds]].
auto& ns = zoned_date_time->nanoseconds();
@ -398,7 +398,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Return zonedDateTime.[[Nanoseconds]].
return &zoned_date_time->nanoseconds();
@ -409,7 +409,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -432,7 +432,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -455,7 +455,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -478,7 +478,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -529,7 +529,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -552,7 +552,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -575,7 +575,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -598,7 +598,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -621,7 +621,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -644,7 +644,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -661,7 +661,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(global_object));
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()));
@ -676,7 +676,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -699,7 +699,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -724,7 +724,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(global_object));
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()) {
@ -795,7 +795,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
PlainTime* plain_time = nullptr;
@ -837,7 +837,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(global_object));
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)));
@ -869,7 +869,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(global_object));
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)));
@ -883,7 +883,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(global_object));
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)));
@ -900,7 +900,7 @@ 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(global_object));
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));
@ -914,7 +914,7 @@ 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(global_object));
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));
@ -928,7 +928,7 @@ 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(global_object));
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));
@ -942,7 +942,7 @@ 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(global_object));
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));
@ -955,7 +955,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. If roundTo is undefined, then
if (vm.argument(0).is_undefined()) {
@ -1044,7 +1044,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(global_object));
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)));
@ -1066,7 +1066,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(global_object));
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)));
@ -1096,7 +1096,7 @@ 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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Return ? TemporalZonedDateTimeToString(zonedDateTime, "auto", "auto", "auto", "auto").
return js_string(vm, TRY(temporal_zoned_date_time_to_string(vm, *zoned_date_time, "auto"sv, "auto"sv, "auto"sv, "auto"sv)));
@ -1107,7 +1107,7 @@ 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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Return ? TemporalZonedDateTimeToString(zonedDateTime, "auto", "auto", "auto", "auto").
return js_string(vm, TRY(temporal_zoned_date_time_to_string(vm, *zoned_date_time, "auto"sv, "auto"sv, "auto"sv, "auto"sv)));
@ -1125,7 +1125,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -1154,7 +1154,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Return ! CreateTemporalInstant(zonedDateTime.[[Nanoseconds]]).
return MUST(create_temporal_instant(vm, zoned_date_time->nanoseconds()));
@ -1165,7 +1165,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -1188,7 +1188,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -1211,7 +1211,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -1228,7 +1228,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -1257,7 +1257,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let timeZone be zonedDateTime.[[TimeZone]].
auto& time_zone = zoned_date_time->time_zone();
@ -1288,7 +1288,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(global_object));
auto* zoned_date_time = TRY(typed_this_object(vm));
// 3. Let fields be OrdinaryObjectCreate(%Object.prototype%).
auto* fields = Object::create(realm, global_object.object_prototype());