-
Notifications
You must be signed in to change notification settings - Fork 15
Conversation
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.
@@ -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]] »). |
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.
Is the .[[Value]] needed here? Doesn’t the ? / ReturnIfAbrupt unwrap the completion record for you?
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.
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 »). |
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.
Not sure if this is a typo, but if so:
1. Let _has_ be ? Call(_hasCheck_, _set_, « e »). | |
1. Let _has_ be ? Call(_hasCheck_, _set_, « _nextValue_ »). |
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.
Fixed.
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.
lgtm once @ljharb's comment is fixed.
2128ca1
to
cba6a49
Compare
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.
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.
Based on conclusion in #35 (comment)