Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Update spec #36

Merged
merged 5 commits into from
Dec 19, 2018
Merged

Update spec #36

merged 5 commits into from
Dec 19, 2018

Conversation

gsathya
Copy link
Member

@gsathya gsathya commented Dec 19, 2018

Based on conclusion in #35 (comment)

Iterate over the argument (using the iteration protocol) instead of
iterating over the receiver (by looking up the internal slot).

Remove the internal slot check as it's no longer required.
@gsathya gsathya changed the title Update spec based Update spec Dec 19, 2018
@@ -12,8 +11,7 @@
1. Let _next_ be IteratorStep(_iter_).
1. If _next_ is *false*, return *true*.
1. Let _nextValue_ be ? IteratorValue(_next_).
1. Let _has_ be ? Call(_hasCheck_, _set_, « e »).
1. Let _has_ be ? Call(_hasCheck_, _set_, « _nextValue_.[[Value]] »).
Copy link
Member

Choose a reason for hiding this comment

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

Is the .[[Value]] needed here? Doesn’t the ? / ReturnIfAbrupt unwrap the completion record for you?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed! I was mostly going off the Set constructor in the spec which was recently fixed too (tc39/ecma262#1310) 😄

Updated all the other methods to do the same too.

1. Let _next_ be IteratorStep(_iter_).
1. If _next_ is *false*, return *true*.
1. Let _nextValue_ be ? IteratorValue(_next_).
1. Let _has_ be ? Call(_hasCheck_, _set_, « e »).
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if this is a typo, but if so:

Suggested change
1. Let _has_ be ? Call(_hasCheck_, _set_, « e »).
1. Let _has_ be ? Call(_hasCheck_, _set_, « _nextValue_ »).

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

Copy link

@ajklein ajklein left a comment

Choose a reason for hiding this comment

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

lgtm once @ljharb's comment is fixed.

@gsathya gsathya force-pushed the fix-review-comments-from-adam branch from 2128ca1 to cba6a49 Compare December 19, 2018 23:03
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

Seems good.

It's still strange to me that we'd make these Set methods not all check the internal slot, thus making them borrowable, but I agree that it makes them more consistent.

@gsathya gsathya merged commit 08b2b3f into master Dec 19, 2018
@gsathya gsathya deleted the fix-review-comments-from-adam branch December 20, 2018 04:34
zloirock added a commit to zloirock/core-js that referenced this pull request Dec 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants