Skip to content
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

remove hint from GetIteratorFlattenable #271

Merged
merged 4 commits into from Mar 30, 2023
Merged

Conversation

michaelficarra
Copy link
Member

This should have been included with #263.

spec.html Outdated
1. Set _alreadyAsync_ to *false*.
1. If IsCallable(_method_) is *false*, then
1. Let _method_ be ? GetMethod(_obj_, @@iterator).
1. If _method_ is *undefined*, then
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change from Get/IsCallable to GetMethod/undefined is technically normative, but it more closely matches the existing GetIterator behaviour. If obj has a Symbol.iterator property that is non-callable, it will now throw instead of falling back to treating obj as an iterator.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed this to split it into a separate PR.

edit: See #272.

1. Let _iterator_ be _obj_.
1. Set _alreadyAsync_ to *true*.
1. Else,
1. Let _iterator_ be ? Call(_method_, _obj_).
1. If _iterator_ is not an Object, throw a *TypeError* exception.
1. Let _nextMethod_ be ? Get(_iterator_, *"next"*).
1. If IsCallable(_nextMethod_) is *false*, throw a *TypeError* exception.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line diverges from GetIterator but the early failure is IMO better. See related tc39/ecma262#3033.

Copy link
Collaborator

@bakkot bakkot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is purely editorial: it's removing a parameter whose value never changes and the paths for handling other values for that parameter.

@michaelficarra michaelficarra merged commit eb62379 into main Mar 30, 2023
1 check passed
@michaelficarra michaelficarra deleted the michaelficarra-patch-1 branch March 30, 2023 16:25
ljharb added a commit to es-shims/iterator-helpers that referenced this pull request Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants