Skip to content

Commit

Permalink
Assert type of calendar in CreateTemporalFoo operations
Browse files Browse the repository at this point in the history
This was inconsistent across the various types; make it consistently
assert, not throw, that the given calendar is an object.

See: #1424
  • Loading branch information
ptomato committed Apr 16, 2021
1 parent dde3968 commit 21395b1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion spec/plaindate.html
Original file line number Diff line number Diff line change
Expand Up @@ -651,9 +651,9 @@ <h1>CreateTemporalDate ( _isoYear_, _isoMonth_, _isoDay_, _calendar_ [ , _newTar
1. Assert: _isoYear_ is an integer.
1. Assert: _isoMonth_ is an integer.
1. Assert: _isoDay_ is an integer.
1. Assert: Type(_calendar_) is Object.
1. Perform ? RejectISODate(_isoYear_, _isoMonth_, _isoDay_).
1. If ! ISODateTimeWithinLimits(_isoYear_, _isoMonth_, _isoDay_, 12, 0, 0, 0, 0, 0) is not ~in range~, throw a *RangeError* exception.
1. If Type(_calendar_) is not Object, throw a *RangeError* exception.
1. If _newTarget_ is not given, set it to %Temporal.PlainDate%.
1. Let _object_ be ? OrdinaryCreateFromConstructor(_newTarget_, *"%Temporal.PlainDate.prototype%"*, « [[InitializedTemporalDate]], [[ISOYear]], [[ISOMonth]], [[ISODay]], [[Calendar]] »).
1. Set _object_.[[ISOYear]] to _isoYear_.
Expand Down
1 change: 1 addition & 0 deletions spec/plaindatetime.html
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,7 @@ <h1>BalanceISODateTime ( _year_, _month_, _day_, _hour_, _minute_, _second_, _mi
<emu-clause id="sec-temporal-createtemporaldatetime" aoid="CreateTemporalDateTime">
<h1>CreateTemporalDateTime ( _isoYear_, _isoMonth_, _isoDay_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_, _calendar_ [ , _newTarget_ ] )</h1>
<emu-alg>
1. Assert: Type(_calendar_) is Object.
1. If ! ValidateISODateTime(_isoYear_, _isoMonth_, _isoDay_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_) is *false*, then
1. Throw a *RangeError* exception.
1. If ! ISODateTimeWithinLimits(_isoYear_, _isoMonth_, _isoDay_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_) is not ~in range~, then
Expand Down
1 change: 1 addition & 0 deletions spec/plainmonthday.html
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ <h1>ToTemporalMonthDay ( _item_ [ , _options_ ] )</h1>
<emu-clause id="sec-temporal-createtemporalmonthday" aoid="CreateTemporalMonthDay">
<h1>CreateTemporalMonthDay ( _isoMonth_, _isoDay_, _calendar_, _referenceISOYear_ [ , _newTarget_ ] )</h1>
<emu-alg>
1. Assert: Type(_calendar_) is Object.
1. If ! ValidateISODate(_referenceISOYear_, _isoMonth_, _isoDay_) is *false*, then
1. Throw a *RangeError* exception.
1. If _newTarget_ is not given, set it to %Temporal.PlainMonthDay%.
Expand Down
1 change: 1 addition & 0 deletions spec/plainyearmonth.html
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ <h1>ConstrainISOYearMonth ( _year_, _month_ )</h1>
<emu-clause id="sec-temporal-createtemporalyearmonth" aoid="CreateTemporalYearMonth">
<h1>CreateTemporalYearMonth ( _isoYear_, _isoMonth_, _calendar_, _referenceISODay_ [ , _newTarget_ ] )</h1>
<emu-alg>
1. Assert: Type(_calendar_) is Object.
1. If ! ValidateISODate(_isoYear_, _isoMonth_, _referenceISODay_) is *false*, then
1. Throw a *RangeError* exception.
1. If ! ValidateISOYearMonthRange(_isoYear_, _isoMonth_) is *false*, then
Expand Down

0 comments on commit 21395b1

Please sign in to comment.