Commit 4ad4ba1d authored by Frank Tang's avatar Frank Tang Committed by V8 LUCI CQ

[Temporal] Add Plain(Date)?Time.prototype.with

Refactor ToTemporalTimeRecord to a new routine
ToTemporalTimeRecordOrPartialTime to share code with ToPartilTime
Change the return type of ToTemporalTimeRecord, RegulateTime

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plaintime.prototype.with
https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.with
https://tc39.es/proposal-temporal/#sec-temporal-topartialtime

Bug: v8:11544
Change-Id: I214147f497a405ee48e264833c7c0b9401596c01
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3665269Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80769}
parent ee6c6a2f
......@@ -56,8 +56,6 @@ TO_BE_IMPLEMENTED(TemporalPlainDatePrototypeEquals)
TO_BE_IMPLEMENTED(TemporalPlainTimePrototypeAdd)
/* Temporal #sec-temporal.plaintime.prototype.subtract */
TO_BE_IMPLEMENTED(TemporalPlainTimePrototypeSubtract)
/* Temporal #sec-temporal.plaintime.prototype.with */
TO_BE_IMPLEMENTED(TemporalPlainTimePrototypeWith)
/* Temporal #sec-temporal.plaintime.prototype.until */
TO_BE_IMPLEMENTED(TemporalPlainTimePrototypeUntil)
/* Temporal #sec-temporal.plaintime.prototype.since */
......@@ -72,8 +70,6 @@ TO_BE_IMPLEMENTED(TemporalPlainTimePrototypeToString)
/* Temporal.PlaneDateTime */
/* Temporal #sec-temporal.plaindatetime.compare */
TO_BE_IMPLEMENTED(TemporalPlainDateTimeCompare)
/* Temporal #sec-temporal.plaindatetime.prototype.with */
TO_BE_IMPLEMENTED(TemporalPlainDateTimePrototypeWith)
/* Temporal #sec-temporal.plaindatetime.prototype.add */
TO_BE_IMPLEMENTED(TemporalPlainDateTimePrototypeAdd)
/* Temporal #sec-temporal.plaindatetime.prototype.subtract */
......@@ -427,6 +423,7 @@ TEMPORAL_METHOD2(PlainTime, Compare)
TEMPORAL_PROTOTYPE_METHOD1(PlainTime, Equals, equals)
TEMPORAL_PROTOTYPE_METHOD0(PlainTime, GetISOFields, getISOFields)
TEMPORAL_PROTOTYPE_METHOD1(PlainTime, ToPlainDateTime, toPlainDateTime)
TEMPORAL_PROTOTYPE_METHOD2(PlainTime, With, with)
TEMPORAL_VALUE_OF(PlainTime)
TEMPORAL_PROTOTYPE_METHOD0(PlainTime, ToJSON, toJSON)
......@@ -475,6 +472,7 @@ TEMPORAL_PROTOTYPE_METHOD0(PlainDateTime, ToPlainMonthDay, toPlainMonthDay)
TEMPORAL_PROTOTYPE_METHOD2(PlainDateTime, ToZonedDateTime, toZonedDateTime)
TEMPORAL_PROTOTYPE_METHOD0(PlainDateTime, GetISOFields, getISOFields)
TEMPORAL_PROTOTYPE_METHOD1(PlainDateTime, WithPlainDate, withPlainDate)
TEMPORAL_PROTOTYPE_METHOD2(PlainDateTime, With, with)
TEMPORAL_VALUE_OF(PlainDateTime)
TEMPORAL_PROTOTYPE_METHOD0(PlainDateTime, ToPlainDate, toPlainDate)
TEMPORAL_PROTOTYPE_METHOD0(PlainDateTime, ToPlainTime, toPlainTime)
......
This diff is collapsed.
......@@ -379,6 +379,11 @@ class JSTemporalPlainDateTime
V8_WARN_UNUSED_RESULT static MaybeHandle<JSReceiver> GetISOFields(
Isolate* isolate, Handle<JSTemporalPlainDateTime> date_time);
// #sec-temporal.plaindatetime.prototype.with
V8_WARN_UNUSED_RESULT static MaybeHandle<JSTemporalPlainDateTime> With(
Isolate* isolate, Handle<JSTemporalPlainDateTime> date_time,
Handle<Object> temporal_date_time_like, Handle<Object> options);
// #sec-temporal.now.plaindatetime
V8_WARN_UNUSED_RESULT static MaybeHandle<JSTemporalPlainDateTime> Now(
Isolate* isolate, Handle<Object> calendar_like,
......@@ -493,6 +498,11 @@ class JSTemporalPlainTime
ToPlainDateTime(Isolate* isolate, Handle<JSTemporalPlainTime> plain_time,
Handle<Object> temporal_date);
// #sec-temporal.plaintime.prototype.with
V8_WARN_UNUSED_RESULT static MaybeHandle<JSTemporalPlainTime> With(
Isolate* isolate, Handle<JSTemporalPlainTime> plain_time,
Handle<Object> temporal_time_like, Handle<Object> options);
// #sec-temporal.now.plaintimeiso
V8_WARN_UNUSED_RESULT static MaybeHandle<JSTemporalPlainTime> NowISO(
Isolate* isolate, Handle<Object> temporal_time_zone_like);
......
......@@ -67,7 +67,6 @@
'temporal/plain-date-time-equals': [FAIL],
'temporal/plain-date-time-subtract': [FAIL],
'temporal/plain-date-time-to-json': [FAIL],
'temporal/plain-date-time-with': [FAIL],
'temporal/plain-date-to-plain-date-time': [FAIL],
'temporal/plain-date-with': [FAIL],
......
......@@ -999,19 +999,7 @@
'built-ins/Temporal/PlainDateTime/prototype/until/smallestunit-plurals-accepted': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/until/smallestunit-undefined': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/until/smallestunit-wrong-type': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/branding': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/calendar-fields-iterable': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/calendar-merge-fields-returns-primitive': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/copies-merge-fields-object': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/infinity-throws-rangeerror': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/options-undefined': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/order-of-operations': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/overflow-invalid-string': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/overflow-undefined': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/overflow-wrong-type': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-zoneddatetime-balance-negative-time-units': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/read-time-fields-before-datefromfields': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/subclassing-ignored': [FAIL],
'built-ins/Temporal/PlainMonthDay/from/calendar-monthdayfromfields-called-with-options-undefined': [FAIL],
'built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-with-utc-designator': [FAIL],
'built-ins/Temporal/PlainMonthDay/prototype/equals/argument-wrong-type': [FAIL],
......@@ -1148,18 +1136,7 @@
'built-ins/Temporal/PlainTime/prototype/until/smallestunit-plurals-accepted': [FAIL],
'built-ins/Temporal/PlainTime/prototype/until/smallestunit-undefined': [FAIL],
'built-ins/Temporal/PlainTime/prototype/until/smallestunit-wrong-type': [FAIL],
'built-ins/Temporal/PlainTime/prototype/with/argument-not-object': [FAIL],
'built-ins/Temporal/PlainTime/prototype/with/basic': [FAIL],
'built-ins/Temporal/PlainTime/prototype/with/branding': [FAIL],
'built-ins/Temporal/PlainTime/prototype/with/infinity-throws-rangeerror': [FAIL],
'built-ins/Temporal/PlainTime/prototype/with/options-invalid': [FAIL],
'built-ins/Temporal/PlainTime/prototype/with/options-undefined': [FAIL],
'built-ins/Temporal/PlainTime/prototype/with/order-of-operations': [FAIL],
'built-ins/Temporal/PlainTime/prototype/with/overflow-invalid-string': [FAIL],
'built-ins/Temporal/PlainTime/prototype/with/overflow-undefined': [FAIL],
'built-ins/Temporal/PlainTime/prototype/with/overflow-wrong-type': [FAIL],
'built-ins/Temporal/PlainTime/prototype/with/plaintimelike-invalid': [FAIL],
'built-ins/Temporal/PlainTime/prototype/with/subclassing-ignored': [FAIL],
'built-ins/Temporal/PlainYearMonth/compare/argument-string-with-utc-designator': [FAIL],
'built-ins/Temporal/PlainYearMonth/compare/calendar-fields-iterable': [FAIL],
'built-ins/Temporal/PlainYearMonth/compare/calendar-temporal-object': [FAIL],
......@@ -1743,7 +1720,6 @@
'built-ins/Temporal/PlainDateTime/prototype/subtract/argument-string-fractional-units-rounding-mode': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/until/largestunit-smallestunit-mismatch': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/until/year-zero': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/copy-properties-not-undefined': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-no-implicit-midnight': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-time-designator-required-for-disambiguation': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-with-time-designator': [FAIL],
......@@ -1835,7 +1811,6 @@
'built-ins/Temporal/PlainTime/prototype/until/roundingmode-halfExpand': [FAIL],
'built-ins/Temporal/PlainTime/prototype/until/roundingmode-trunc': [FAIL],
'built-ins/Temporal/PlainTime/prototype/until/year-zero': [FAIL],
'built-ins/Temporal/PlainTime/prototype/with/copy-properties-not-undefined': [FAIL],
'built-ins/Temporal/PlainYearMonth/compare/argument-cast': [FAIL],
'built-ins/Temporal/PlainYearMonth/compare/basic': [FAIL],
'built-ins/Temporal/PlainYearMonth/compare/compare-calendar': [FAIL],
......@@ -1956,15 +1931,6 @@
'built-ins/Temporal/PlainDateTime/prototype/until/units-changed': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/until/weeks-months-mutually-exclusive': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/weekOfYear/basic': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/argument-object-insufficient-data': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/basic': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/calendar-throws': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/month-and-monthcode-must-agree': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/multiple-unrecognized-properties-ignored': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/options-empty': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/options-invalid': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/string-throws': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/timezone-throws': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-invalid': [FAIL],
'built-ins/Temporal/Duration/compare/options-wrong-type': [FAIL],
......@@ -2064,17 +2030,12 @@
'built-ins/Temporal/PlainDateTime/prototype/until/roundingmode-trunc-basic': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/until/roundingmode-trunc-is-default': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/until/round-relative-to-receiver': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/argument-not-object': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/calendar-options': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/calendar-temporal-object-throws': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/with/options-wrong-type': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-object-insufficient-data': [FAIL],
'built-ins/Temporal/PlainTime/prototype/round/options-wrong-type': [FAIL],
'built-ins/Temporal/PlainTime/prototype/round/roundto-invalid-string': [FAIL],
'built-ins/Temporal/PlainTime/prototype/since/options-wrong-type': [FAIL],
'built-ins/Temporal/PlainTime/prototype/toString/options-wrong-type': [FAIL],
'built-ins/Temporal/PlainTime/prototype/until/options-wrong-type': [FAIL],
'built-ins/Temporal/PlainTime/prototype/with/options-wrong-type': [FAIL],
'built-ins/Temporal/PlainYearMonth/prototype/add/options-wrong-type': [FAIL],
'built-ins/Temporal/PlainYearMonth/prototype/since/options-wrong-type': [FAIL],
'built-ins/Temporal/PlainYearMonth/prototype/subtract/options-wrong-type': [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