[Temporal] Add Calendar.prototype.daysInWeek
Spec Text: https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.daysinweek Note- this is only the non-intl version. intl version in https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.daysinweek will be implemented in later cl. Bug: v8:11544 Change-Id: If54733ae7c902b4d189fc22b0800942f8748981c Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3439186 Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Frank Tang <ftang@chromium.org> Cr-Commit-Position: refs/heads/main@{#79721}
This commit is contained in:
parent
63f9f0fab5
commit
b214cb7d72
@ -320,8 +320,6 @@ TO_BE_IMPLEMENTED(TemporalCalendarPrototypeMonthCode)
|
||||
TO_BE_IMPLEMENTED(TemporalCalendarPrototypeDay)
|
||||
/* Temporal #sec-temporal.calendar.prototype.weekofyear */
|
||||
TO_BE_IMPLEMENTED(TemporalCalendarPrototypeWeekOfYear)
|
||||
/* Temporal #sec-temporal.calendar.prototype.daysinweek */
|
||||
TO_BE_IMPLEMENTED(TemporalCalendarPrototypeDaysInWeek)
|
||||
/* Temporal #sec-temporal.calendar.prototype.mergefields */
|
||||
TO_BE_IMPLEMENTED(TemporalCalendarPrototypeMergeFields)
|
||||
/* Temporal #sec-temporal.calendar.prototype.tojson */
|
||||
@ -789,6 +787,7 @@ TEMPORAL_GET_BIGINT_AFTER_DIVID(Instant, EpochMicroseconds, nanoseconds, 1000,
|
||||
TEMPORAL_CONSTRUCTOR1(Calendar)
|
||||
TEMPORAL_ID_BY_TO_STRING(Calendar)
|
||||
TEMPORAL_PROTOTYPE_METHOD1(Calendar, DaysInMonth, daysInMonth)
|
||||
TEMPORAL_PROTOTYPE_METHOD1(Calendar, DaysInWeek, daysInWeek)
|
||||
TEMPORAL_PROTOTYPE_METHOD1(Calendar, DaysInYear, daysInYear)
|
||||
TEMPORAL_PROTOTYPE_METHOD1(Calendar, DayOfWeek, dayOfWeek)
|
||||
TEMPORAL_PROTOTYPE_METHOD1(Calendar, DayOfYear, dayOfYear)
|
||||
|
@ -5089,6 +5089,26 @@ MaybeHandle<Oddball> JSTemporalCalendar::InLeapYear(
|
||||
return isolate->factory()->ToBoolean(IsISOLeapYear(isolate, year));
|
||||
}
|
||||
|
||||
// #sec-temporal.calendar.prototype.daysinweek
|
||||
MaybeHandle<Smi> JSTemporalCalendar::DaysInWeek(
|
||||
Isolate* isolate, Handle<JSTemporalCalendar> calendar,
|
||||
Handle<Object> temporal_date_like) {
|
||||
// 1. Let calendar be the this value.
|
||||
// 2. Perform ? RequireInternalSlot(calendar,
|
||||
// [[InitializedTemporalCalendar]]).
|
||||
// 3. Assert: calendar.[[Identifier]] is "iso8601".
|
||||
// 4. Perform ? ToTemporalDate(temporalDateLike).
|
||||
Handle<JSTemporalPlainDate> date;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate, date,
|
||||
ToTemporalDate(isolate, temporal_date_like,
|
||||
isolate->factory()->NewJSObjectWithNullProto(),
|
||||
"Temporal.Calendar.prototype.daysInWeek"),
|
||||
Smi);
|
||||
// 5. Return 7𝔽.
|
||||
return handle(Smi::FromInt(7), isolate);
|
||||
}
|
||||
|
||||
// #sec-temporal.calendar.prototype.tostring
|
||||
MaybeHandle<String> JSTemporalCalendar::ToString(
|
||||
Isolate* isolate, Handle<JSTemporalCalendar> calendar,
|
||||
|
@ -87,6 +87,11 @@ class JSTemporalCalendar
|
||||
Isolate* isolate, Handle<JSTemporalCalendar> calendar,
|
||||
Handle<Object> temporal_date_like);
|
||||
|
||||
// #sec-temporal.calendar.prototype.daysinweek
|
||||
V8_WARN_UNUSED_RESULT static MaybeHandle<Smi> DaysInWeek(
|
||||
Isolate* isolate, Handle<JSTemporalCalendar> calendar,
|
||||
Handle<Object> temporal_date_like);
|
||||
|
||||
// #sec-temporal.calendar.prototype.tostring
|
||||
static MaybeHandle<String> ToString(Isolate* isolate,
|
||||
Handle<JSTemporalCalendar> calendar,
|
||||
|
@ -48,7 +48,6 @@
|
||||
'temporal/calendar-date-from-fields': [FAIL],
|
||||
'temporal/calendar-date-until': [FAIL],
|
||||
'temporal/calendar-day': [FAIL],
|
||||
'temporal/calendar-days-in-week': [FAIL],
|
||||
'temporal/calendar-fields': [FAIL],
|
||||
'temporal/calendar-merge-fields': [FAIL],
|
||||
'temporal/calendar-month': [FAIL],
|
||||
|
@ -500,20 +500,10 @@
|
||||
'built-ins/Temporal/Calendar/prototype/daysInMonth/calendar-fields-iterable': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/daysInMonth/calendar-temporal-object': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/daysInMonth/infinity-throws-rangeerror': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-with-utc-designator': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/daysInWeek/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/daysInWeek/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/daysInWeek/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/daysInWeek/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/daysInWeek/basic': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/daysInWeek/branding': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/daysInWeek/calendar-fields-iterable': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/daysInWeek/calendar-temporal-object': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/daysInWeek/date': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/daysInWeek/date-time': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/daysInWeek/infinity-throws-rangeerror': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/daysInWeek/string': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/daysInWeek/throw-range-error-ToTemporalDate': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/daysInYear/basic': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/daysInYear/calendar-fields-iterable': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/daysInYear/calendar-temporal-object': [FAIL],
|
||||
@ -933,7 +923,6 @@
|
||||
'built-ins/Temporal/PlainDate/prototype/add/subclassing-ignored': [FAIL],
|
||||
'built-ins/Temporal/PlainDate/prototype/dayOfWeek/basic': [FAIL],
|
||||
'built-ins/Temporal/PlainDate/prototype/dayOfYear/basic': [FAIL],
|
||||
'built-ins/Temporal/PlainDate/prototype/daysInWeek/basic': [FAIL],
|
||||
'built-ins/Temporal/PlainDate/prototype/equals/argument-object-invalid': [FAIL],
|
||||
'built-ins/Temporal/PlainDate/prototype/equals/argument-object-valid': [FAIL],
|
||||
'built-ins/Temporal/PlainDate/prototype/equals/argument-plaindatetime': [FAIL],
|
||||
@ -2648,7 +2637,6 @@
|
||||
'built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-invalid': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-invalid': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/day/argument-string-invalid': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-invalid': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/month/argument-string-invalid': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/monthCode/argument-string-invalid': [FAIL],
|
||||
'built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-invalid': [FAIL],
|
||||
@ -2697,7 +2685,6 @@
|
||||
'built-ins/Temporal/PlainDateTime/prototype/add/negative-duration': [FAIL],
|
||||
'built-ins/Temporal/PlainDateTime/prototype/add/options-empty': [FAIL],
|
||||
'built-ins/Temporal/PlainDateTime/prototype/add/options-invalid': [FAIL],
|
||||
'built-ins/Temporal/PlainDateTime/prototype/daysInWeek/basic': [FAIL],
|
||||
'built-ins/Temporal/PlainDateTime/prototype/equals/argument-object-insufficient-data': [FAIL],
|
||||
'built-ins/Temporal/PlainDateTime/prototype/equals/basic': [FAIL],
|
||||
'built-ins/Temporal/PlainDateTime/prototype/equals/cast': [FAIL],
|
||||
|
Loading…
Reference in New Issue
Block a user