Skip to content

Commit

Permalink
Remove spurious calls to GetOptionsObject
Browse files Browse the repository at this point in the history
These are mistakes from #2586. Spotted by Anba.

Closes: #2620
  • Loading branch information
ptomato committed Sep 8, 2023
1 parent ed89b9b commit 05f7a11
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions polyfill/lib/ecmascript.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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, []);

Expand Down
4 changes: 2 additions & 2 deletions spec/plainyearmonth.html
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,6 @@ <h1>
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_, «»).
Expand All @@ -684,7 +683,8 @@ <h1>
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_).
Expand Down

0 comments on commit 05f7a11

Please sign in to comment.