Commit 25ae9851 authored by Frank Tang's avatar Frank Tang Committed by V8 LUCI CQ

[Temporal] Sync PR2377 order of observable in ...FromFields()

Sync to the spec/calendar.html changes in
https://github.com/tc39/proposal-temporal/pull/2377
to change the order of calling ToTemporalOverflow.
This cl only cover the ISO8601 part, the the intl part of the PR
is not yet implemented and will be handle when e implemenet them.

Spec text:
https://tc39.es/proposal-temporal/#sec-temporal-isodatefromfields
https://tc39.es/proposal-temporal/#sec-temporal-isoyearmonthfromfields
https://tc39.es/proposal-temporal/#sec-temporal-isomonthdayfromfields

Bug: v8:11544
Change-Id: Ia4386d460dc45b0b377a483c6f4793da4cbd7c20
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3903223
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83410}
parent 97c0084b
......@@ -6381,19 +6381,18 @@ Maybe<DateRecord> ISOMonthDayFromFields(Isolate* isolate,
const char* method_name) {
Factory* factory = isolate->factory();
// 1. Assert: Type(fields) is Object.
// 2. Let overflow be ? ToTemporalOverflow(options).
ShowOverflow overflow;
MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, overflow, ToTemporalOverflow(isolate, options, method_name),
Nothing<DateRecord>());
// 3. Set fields to ? PrepareTemporalFields(fields, « "day", "month",
// 2. Set fields to ? PrepareTemporalFields(fields, « "day", "month",
// "monthCode", "year" », «"day"»).
Handle<FixedArray> field_names = DayMonthMonthCodeYearInFixedArray(isolate);
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, fields,
PrepareTemporalFields(isolate, fields, field_names, RequiredFields::kDay),
Nothing<DateRecord>());
// 3. Let overflow be ? ToTemporalOverflow(options).
ShowOverflow overflow;
MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, overflow, ToTemporalOverflow(isolate, options, method_name),
Nothing<DateRecord>());
// 4. Let month be ! Get(fields, "month").
Handle<Object> month_obj =
JSReceiver::GetProperty(isolate, fields, factory->month_string())
......@@ -9705,12 +9704,7 @@ Maybe<DateRecord> ISODateFromFields(Isolate* isolate, Handle<JSReceiver> fields,
Factory* factory = isolate->factory();
// 1. Assert: Type(fields) is Object.
// 2. Let overflow be ? ToTemporalOverflow(options).
ShowOverflow overflow;
MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, overflow, ToTemporalOverflow(isolate, options, method_name),
Nothing<DateRecord>());
// 3. Set fields to ? PrepareTemporalFields(fields, « "day", "month",
// 2. Set fields to ? PrepareTemporalFields(fields, « "day", "month",
// "monthCode", "year" », «"year", "day"»).
Handle<FixedArray> field_names = DayMonthMonthCodeYearInFixedArray(isolate);
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
......@@ -9718,6 +9712,11 @@ Maybe<DateRecord> ISODateFromFields(Isolate* isolate, Handle<JSReceiver> fields,
PrepareTemporalFields(isolate, fields, field_names,
RequiredFields::kYearAndDay),
Nothing<DateRecord>());
// 3. Let overflow be ? ToTemporalOverflow(options).
ShowOverflow overflow;
MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, overflow, ToTemporalOverflow(isolate, options, method_name),
Nothing<DateRecord>());
// 4. Let year be ! Get(fields, "year").
Handle<Object> year_obj =
......@@ -9976,12 +9975,7 @@ Maybe<DateRecord> ISOYearMonthFromFields(Isolate* isolate,
const char* method_name) {
Factory* factory = isolate->factory();
// 1. Assert: Type(fields) is Object.
// 2. Let overflow be ? ToTemporalOverflow(options).
ShowOverflow overflow;
MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, overflow, ToTemporalOverflow(isolate, options, method_name),
Nothing<DateRecord>());
// 3. Set fields to ? PrepareTemporalFields(fields, « "month", "monthCode",
// 2. Set fields to ? PrepareTemporalFields(fields, « "month", "monthCode",
// "year" », «»).
Handle<FixedArray> field_names = factory->NewFixedArray(3);
field_names->set(0, ReadOnlyRoots(isolate).month_string());
......@@ -9992,6 +9986,11 @@ Maybe<DateRecord> ISOYearMonthFromFields(Isolate* isolate,
PrepareTemporalFields(isolate, fields, field_names,
RequiredFields::kNone),
Nothing<DateRecord>());
// 3. Let overflow be ? ToTemporalOverflow(options).
ShowOverflow overflow;
MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, overflow, ToTemporalOverflow(isolate, options, method_name),
Nothing<DateRecord>());
// 4. Let year be ! Get(fields, "year").
Handle<Object> year_obj =
......
......@@ -494,7 +494,6 @@
'built-ins/Temporal/Calendar/from/calendar-case-insensitive': [FAIL],
'built-ins/Temporal/Calendar/prototype/dateAdd/argument-propertybag-calendar-case-insensitive': [FAIL],
'built-ins/Temporal/Calendar/prototype/dateFromFields/order-of-operations': [FAIL],
'built-ins/Temporal/Calendar/prototype/day/argument-propertybag-calendar-case-insensitive': [FAIL],
'built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-propertybag-calendar-case-insensitive': [FAIL],
'built-ins/Temporal/Calendar/prototype/dayOfYear/argument-propertybag-calendar-case-insensitive': [FAIL],
......@@ -504,11 +503,9 @@
'built-ins/Temporal/Calendar/prototype/inLeapYear/argument-propertybag-calendar-case-insensitive': [FAIL],
'built-ins/Temporal/Calendar/prototype/month/argument-propertybag-calendar-case-insensitive': [FAIL],
'built-ins/Temporal/Calendar/prototype/monthCode/argument-propertybag-calendar-case-insensitive': [FAIL],
'built-ins/Temporal/Calendar/prototype/monthDayFromFields/order-of-operations': [FAIL],
'built-ins/Temporal/Calendar/prototype/monthsInYear/argument-propertybag-calendar-case-insensitive': [FAIL],
'built-ins/Temporal/Calendar/prototype/weekOfYear/argument-propertybag-calendar-case-insensitive': [FAIL],
'built-ins/Temporal/Calendar/prototype/year/argument-propertybag-calendar-case-insensitive': [FAIL],
'built-ins/Temporal/Calendar/prototype/yearMonthFromFields/order-of-operations': [FAIL],
'built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-case-insensitive': [FAIL],
'built-ins/Temporal/Now/plainDate/calendar-case-insensitive': [FAIL],
'built-ins/Temporal/Now/plainDateTime/calendar-case-insensitive': [FAIL],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment