From 2fa1b21435449264a17e61b3ba44dff6dde430f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Wed, 10 Jul 2024 08:32:41 +0200 Subject: [PATCH] Editorial: Remove 'default' optional parameter from ToTemporalCalendarSlotValue First change `ToTemporalMonthDay` to call `GetTemporalCalendarSlotValueWithISODefault`, so the only place which uses the `default` optional parameter is `GetTemporalCalendarSlotValueWithISODefault`. And then handle the `undefined` case directly in `GetTemporalCalendarSlotValueWithISODefault`. (Rebased by Philip: Rename SlotValue -> Identifier) --- spec/calendar.html | 9 +++------ spec/plainmonthday.html | 6 +----- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/spec/calendar.html b/spec/calendar.html index 7ffa98c98..6998ae6bd 100644 --- a/spec/calendar.html +++ b/spec/calendar.html @@ -751,20 +751,15 @@

ToTemporalCalendarIdentifier ( _temporalCalendarLike_: an ECMAScript value, - optional _default_: a String, ): either a normal completion containing a String or a throw completion

description
It attempts to derive a value from _temporalCalendarLike_ that is a calendar identifier according to IsBuiltinCalendar, and returns that value if found or throws an exception if not. - An optional _default_ built-in calendar identifier may be provided, which is returned if _temporalCalendarLike_ is *undefined*.
- 1. If _temporalCalendarLike_ is *undefined* and _default_ is present, then - 1. Assert: IsBuiltinCalendar(_default_) is *true*. - 1. Return _default_. 1. If _temporalCalendarLike_ is an Object, then 1. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then 1. Return _temporalCalendarLike_.[[Calendar]]. @@ -792,7 +787,9 @@

1. If _item_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then 1. Return _item_.[[Calendar]]. 1. Let _calendarLike_ be ? Get(_item_, *"calendar"*). - 1. Return ? ToTemporalCalendarIdentifier(_calendarLike_, *"iso8601"*). + 1. If _calendarLike_ is *undefined*, then + 1. Return *"iso8601"*. + 1. Return ? ToTemporalCalendarIdentifier(_calendarLike_). diff --git a/spec/plainmonthday.html b/spec/plainmonthday.html index 7a00e9871..7822561f6 100644 --- a/spec/plainmonthday.html +++ b/spec/plainmonthday.html @@ -343,11 +343,7 @@

1. Set _options_ to ? GetOptionsObject(_options_). 1. Perform ? GetTemporalOverflowOption(_options_). 1. Return _item_. - 1. If _item_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then - 1. Let _calendar_ be _item_.[[Calendar]]. - 1. Else, - 1. Let _calendarLike_ be ? Get(_item_, *"calendar"*). - 1. Let _calendar_ be ? ToTemporalCalendarIdentifier(_calendarLike_, *"iso8601"*). + 1. Let _calendar_ be ? GetTemporalCalendarIdentifierWithISODefault(_item_). 1. Let _fields_ be ? PrepareCalendarFields(_calendar_, _item_, « ~day~, ~month~, ~month-code~, ~year~ », «», «»). 1. Set _options_ to ? GetOptionsObject(_options_). 1. Let _overflow_ be ? GetTemporalOverflowOption(_options_).