-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normative: Perform a single "dateAdd" lookup for MoveRelativeDate #2267
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2267 +/- ##
==========================================
- Coverage 95.01% 91.06% -3.96%
==========================================
Files 20 19 -1
Lines 10833 10528 -305
Branches 1937 1699 -238
==========================================
- Hits 10293 9587 -706
- Misses 504 929 +425
+ Partials 36 12 -24
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this makes sense. I probably overlooked that MoveRelativeDate calls dateAdd when we consolidated the dateAdd calls earlier.
I will mark this as draft until presented to TC39.
`CalendarDateAdd` was changed to avoid repeated lookups of `"dateAdd"`, but we still repeatedly lookup `"dateAdd"` when `CalendarDateAdd` is called from `MoveRelativeDate`.
…lativeDate calls Add `dateAdd` to all remaining `MoveRelativeDate` calls.
All callers are now passing `dateAdd`, so the parameter no longer needs to be optional.
…dDateTime The reference code was out of line with the spec text here, which says that ToTemporalTimeZone must be called before InterpretTemporalDateTimeFields. Both calls are observable. See also tc39#2252
….p.total The reference code was out of line with the spec text here, which says that ToRelativeTemporalObject must be called before GetTemporalUnit. Both calls are observable. See also tc39#2252
…TemporalPlainYearMonth The reference code was out of line with the spec text here, which says that CalendarDateFromFields must be called the first time before the second call to DifferenceTemporalPlainYearMonth. These are observable. See also tc39#2252
This implements the normative change from "Normative: Add optional `dateAdd` parameter to MoveRelativeDate" in the reference code. It eliminates observable Gets of the calendar's dateAdd property each time MoveRelativeDate is called.
See tc39/proposal-temporal#2267 which eliminated some unnecessary lookups of the calendar's dateAdd method from the MoveRelativeDate AO, which is called in the calendar types' since() and until() methods, Duration.p.round(), and Duration.p.total(). This adds tests for the order of all observable operations for these 10 methods, not just the lookups of dateAdd on the calendar. (These methods needed to have their order of observable operations tested anyway.) They heavily use the TemporalHelpers.calendarObserver and TemporalHelpers.timeZoneObserver added in the previous commits. tc39/proposal-temporal#2267 included changes to several code paths, not all of which are reachable through every method tested here; only Duration.p.round() can trigger the full set. tc39/proposal-temporal#2267 reached consensus at the July 2022 TC39 plenary meeting.
See tc39/proposal-temporal#2267 which eliminated some unnecessary lookups of the calendar's dateAdd method from the MoveRelativeDate AO, which is called in the calendar types' since() and until() methods, Duration.p.round(), and Duration.p.total(). This adds tests for the order of all observable operations for these 10 methods, not just the lookups of dateAdd on the calendar. (These methods needed to have their order of observable operations tested anyway.) They heavily use the TemporalHelpers.calendarObserver and TemporalHelpers.timeZoneObserver added in the previous commits. tc39/proposal-temporal#2267 included changes to several code paths, not all of which are reachable through every method tested here; only Duration.p.round() can trigger the full set. tc39/proposal-temporal#2267 reached consensus at the July 2022 TC39 plenary meeting.
48b51d3
to
4e7e352
Compare
This implements the normative change from "Normative: Perform a single "dateAdd" lookup for the remaining MoveRelativeDate calls" in the reference code. It eliminates any remaining places where there were subsequent dateAdd lookups in the same abstract operation.
This implements the editorial change from "Editorial: Change `dateAdd` to a required parameter of MoveRelativeDate" in the reference code.
4e7e352
to
4ad6505
Compare
This reached consensus at the July 2022 TC39 meeting. Tests are in tc39/test262#3674. I've added an implementation of Anba's normative change to the reference code, as well as fixed a couple of observable-order bugs in the reference code that I ran into while writing the tests. |
See tc39/proposal-temporal#2267 which eliminated some unnecessary lookups of the calendar's dateAdd method from the MoveRelativeDate AO, which is called in the calendar types' since() and until() methods, Duration.p.round(), and Duration.p.total(). This adds tests for the order of all observable operations for these 10 methods, not just the lookups of dateAdd on the calendar. (These methods needed to have their order of observable operations tested anyway.) They heavily use the TemporalHelpers.calendarObserver and TemporalHelpers.timeZoneObserver added in the previous commits. tc39/proposal-temporal#2267 included changes to several code paths, not all of which are reachable through every method tested here; only Duration.p.round() can trigger the full set. tc39/proposal-temporal#2267 reached consensus at the July 2022 TC39 plenary meeting.
See tc39/proposal-temporal#2267 which eliminated some unnecessary lookups of the calendar's dateAdd method from the MoveRelativeDate AO, which is called in the calendar types' since() and until() methods, Duration.p.round(), and Duration.p.total(). This adds tests for the order of all observable operations for these 10 methods, not just the lookups of dateAdd on the calendar. (These methods needed to have their order of observable operations tested anyway.) They heavily use the TemporalHelpers.calendarObserver and TemporalHelpers.timeZoneObserver added in the previous commits. tc39/proposal-temporal#2267 included changes to several code paths, not all of which are reachable through every method tested here; only Duration.p.round() can trigger the full set. tc39/proposal-temporal#2267 reached consensus at the July 2022 TC39 plenary meeting.
See tc39/proposal-temporal#2267 which eliminated some unnecessary lookups of the calendar's dateAdd method from the MoveRelativeDate AO, which is called in the calendar types' since() and until() methods, Duration.p.round(), and Duration.p.total(). This adds tests for the order of all observable operations for these 10 methods, not just the lookups of dateAdd on the calendar. (These methods needed to have their order of observable operations tested anyway.) They heavily use the TemporalHelpers.calendarObserver and TemporalHelpers.timeZoneObserver added in the previous commits. tc39/proposal-temporal#2267 included changes to several code paths, not all of which are reachable through every method tested here; only Duration.p.round() can trigger the full set. tc39/proposal-temporal#2267 reached consensus at the July 2022 TC39 plenary meeting.
CalendarDateAdd
was changed to avoid repeated lookups of"dateAdd"
, but we still repeatedly lookup"dateAdd"
whenCalendarDateAdd
is called fromMoveRelativeDate
.