From 573de945e3a00c6ad76237ce68429428c1ff5b4b Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Thu, 7 Sep 2023 12:44:34 -0700 Subject: [PATCH] Remove spurious calls to GetOptionsObject These are mistakes from #2586. Spotted by Anba. Closes: #2620 --- polyfill/lib/ecmascript.mjs | 7 +++---- spec/plainyearmonth.html | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/polyfill/lib/ecmascript.mjs b/polyfill/lib/ecmascript.mjs index ed98a16f11..bdfff3a579 100644 --- a/polyfill/lib/ecmascript.mjs +++ b/polyfill/lib/ecmascript.mjs @@ -4997,12 +4997,10 @@ export function AddDurationToOrSubtractDurationFromPlainYearMonth(operation, yea let { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = duration; ({ days } = BalanceTimeDuration(days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds, 'day')); - options = GetOptionsObject(options); - const calendar = GetSlot(yearMonth, CALENDAR); const fieldNames = CalendarFields(calendar, ['monthCode', 'year']); const fields = PrepareTemporalFields(yearMonth, fieldNames, []); - const fieldsCopy = SnapshotOwnProperties(GetOptionsObject(fields), null); + const fieldsCopy = SnapshotOwnProperties(fields, null); fields.day = 1; let startDate = CalendarDateFromFields(calendar, fields); const sign = DurationSign(years, months, weeks, days, 0, 0, 0, 0, 0, 0); @@ -5017,7 +5015,8 @@ export function AddDurationToOrSubtractDurationFromPlainYearMonth(operation, yea startDate = CalendarDateFromFields(calendar, fieldsCopy); } const durationToAdd = new Duration(years, months, weeks, days, 0, 0, 0, 0, 0, 0); - const optionsCopy = SnapshotOwnProperties(GetOptionsObject(options), null); + options = GetOptionsObject(options); + const optionsCopy = SnapshotOwnProperties(options, null); const addedDate = CalendarDateAdd(calendar, startDate, durationToAdd, options, dateAdd); const addedDateFields = PrepareTemporalFields(addedDate, fieldNames, []); diff --git a/spec/plainyearmonth.html b/spec/plainyearmonth.html index 00ed705565..82ed957b8a 100644 --- a/spec/plainyearmonth.html +++ b/spec/plainyearmonth.html @@ -664,7 +664,6 @@

1. If _operation_ is ~subtract~, then 1. Set _duration_ to ! CreateNegatedTemporalDuration(_duration_). 1. Let _balanceResult_ be ? BalanceTimeDuration(_duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]], *"day"*). - 1. Set _options_ to ? GetOptionsObject(_options_). 1. Let _calendar_ be _yearMonth_.[[Calendar]]. 1. Let _fieldNames_ be ? CalendarFields(_calendar_, « *"monthCode"*, *"year"* »). 1. Let _fields_ be ? PrepareTemporalFields(_yearMonth_, _fieldNames_, «»). @@ -684,7 +683,8 @@

1. Else, 1. Let _date_ be _intermediateDate_. 1. Let _durationToAdd_ be ! CreateTemporalDuration(_duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _balanceResult_.[[Days]], 0, 0, 0, 0, 0, 0). - 1. Let _optionsCopy_ be ? SnapshotOwnProperties(? GetOptionsObject(_options_), *null*). + 1. Set _options_ to ? GetOptionsObject(_options_). + 1. Let _optionsCopy_ be ? SnapshotOwnProperties(_options_, *null*). 1. Let _addedDate_ be ? CalendarDateAdd(_calendar_, _date_, _durationToAdd_, _options_, _dateAdd_). 1. Let _addedDateFields_ be ? PrepareTemporalFields(_addedDate_, _fieldNames_, «»). 1. Return ? CalendarYearMonthFromFields(_calendar_, _addedDateFields_, _optionsCopy_).