mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:27:45 +00:00
LibJS/Temporal: Fix inconsistency in order of observable operations
This is a normative change in the Temporal spec.
See: a3a8237
This commit is contained in:
parent
7394316818
commit
d5d1146cc3
4 changed files with 135 additions and 12 deletions
|
@ -758,12 +758,12 @@ ThrowCompletionOr<ISODateRecord> iso_date_from_fields(VM& vm, Object const& fiel
|
|||
{
|
||||
// 1. Assert: Type(fields) is Object.
|
||||
|
||||
// 2. Let overflow be ? ToTemporalOverflow(options).
|
||||
auto overflow = TRY(to_temporal_overflow(vm, &options));
|
||||
|
||||
// 3. Set fields to ? PrepareTemporalFields(fields, « "day", "month", "monthCode", "year" », « "year", "day" »).
|
||||
// 2. Set fields to ? PrepareTemporalFields(fields, « "day", "month", "monthCode", "year" », « "year", "day" »).
|
||||
auto* prepared_fields = TRY(prepare_temporal_fields(vm, fields, { "day", "month", "monthCode", "year" }, Vector<StringView> { "year"sv, "day"sv }));
|
||||
|
||||
// 3. Let overflow be ? ToTemporalOverflow(options).
|
||||
auto overflow = TRY(to_temporal_overflow(vm, &options));
|
||||
|
||||
// 4. Let year be ! Get(fields, "year").
|
||||
auto year = MUST(prepared_fields->get(vm.names.year));
|
||||
|
||||
|
@ -788,12 +788,12 @@ ThrowCompletionOr<ISOYearMonth> iso_year_month_from_fields(VM& vm, Object const&
|
|||
{
|
||||
// 1. Assert: Type(fields) is Object.
|
||||
|
||||
// 2. Let overflow be ? ToTemporalOverflow(options).
|
||||
auto overflow = TRY(to_temporal_overflow(vm, &options));
|
||||
|
||||
// 3. Set fields to ? PrepareTemporalFields(fields, « "month", "monthCode", "year" », « "year" »).
|
||||
// 2. Set fields to ? PrepareTemporalFields(fields, « "month", "monthCode", "year" », « "year" »).
|
||||
auto* prepared_fields = TRY(prepare_temporal_fields(vm, fields, { "month"sv, "monthCode"sv, "year"sv }, Vector<StringView> { "year"sv }));
|
||||
|
||||
// 3. Let overflow be ? ToTemporalOverflow(options).
|
||||
auto overflow = TRY(to_temporal_overflow(vm, &options));
|
||||
|
||||
// 4. Let year be ! Get(fields, "year").
|
||||
auto year = MUST(prepared_fields->get(vm.names.year));
|
||||
|
||||
|
@ -815,12 +815,12 @@ ThrowCompletionOr<ISOMonthDay> iso_month_day_from_fields(VM& vm, Object const& f
|
|||
{
|
||||
// 1. Assert: Type(fields) is Object.
|
||||
|
||||
// 2. Let overflow be ? ToTemporalOverflow(options).
|
||||
auto overflow = TRY(to_temporal_overflow(vm, &options));
|
||||
|
||||
// 3. Set fields to ? PrepareTemporalFields(fields, « "day", "month", "monthCode", "year" », « "day" »).
|
||||
// 2. Set fields to ? PrepareTemporalFields(fields, « "day", "month", "monthCode", "year" », « "day" »).
|
||||
auto* prepared_fields = TRY(prepare_temporal_fields(vm, fields, { "day"sv, "month"sv, "monthCode"sv, "year"sv }, Vector<StringView> { "day"sv }));
|
||||
|
||||
// 3. Let overflow be ? ToTemporalOverflow(options).
|
||||
auto overflow = TRY(to_temporal_overflow(vm, &options));
|
||||
|
||||
// 4. Let month be ! Get(fields, "month").
|
||||
auto month_value = MUST(prepared_fields->get(vm.names.month));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue