-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Editorial: Clarify GetIterator #3021
Conversation
It's easiest to review this PR commit by commit. |
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.
This is an improvement and doesn't impact the iterator helpers proposal.
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.
I implemented all the AO changes in es-abstract, and it looks good to me. Additionally, iterator helpers' GetIteratorDirect
AO is basically the last 4 steps of GetIteratorFromMethod, so it seems pretty compatible there.
tc39/ecma262#3021 proposes removing optionality from the second argument
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.
I think you missed the downstream consumers check, but I've opened tc39/ecma402#756 to be ready.
spec.html
Outdated
IterableToList ( | ||
_items_: an ECMAScript language value, | ||
optional _method_: a function object, | ||
IteratorToList ( | ||
_iteratorRecord_: an Iterator Record | ||
): either a normal completion containing a List of ECMAScript language values or a throw completion |
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.
@ptomato Assuming this lands, Temporal IterableToListOfType should probably change accordingly.
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.
Thank you.
tc39/ecma262#3021 proposes removing optionality from the second argument
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.
Much nicer.
This removes the optional _hint_ parameter and the weird recursive call in GetIterator.
Also remove the the optional method parameter and change the callsites to explicitly get the iterator.
This is editorial because Call inside GetIteratorFromMethod would throw on undefined anyways, and this keeps GetIteratorFromMethod cleaner in only accepting function objects.
e5edb51
to
784fc65
Compare
Based on the rewrite of IterableToList in tc39/ecma262#3021, this makes the corresponding change to IterableToListOfType.
Based on the rewrite of IterableToList in tc39/ecma262#3021, this makes the corresponding change to IterableToListOfType.
I find GetIterator's optional parameters confusing because the hint is ignored when the method is passed. There's also a recursive call that serves no real purpose.
This PR gets rid of the optional parameters and does some refactoring.