-
Notifications
You must be signed in to change notification settings - Fork 155
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
Reference impl: Use arrow functions for size
functions
#1142
Conversation
This doesn't set the name property. I'm not sure if it's sufficient just to assign it after creating the function. @domenic what's the best thing to do here? |
Chrome and Firefox do seem to infer a const size = () => 1;
size.name // -> "size" |
ECMAScript does indeed require the |
I do find this to be very odd and unexpected behavior, but it is required by ecmascript. Relevant part of the spec, from 14.3.1.2 Runtime Semantics: Evaluation of
capturing |
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!
@ninevra Sorry for the trouble, but could you sign the CLA? https://participate.whatwg.org/agreement-status?user=ninevra&repo=streams&pull=1142 |
Optionally, if you could add a test to https://github.com/web-platform-tests/wpt/blob/master/streams/queuing-strategies.any.js that fails without this change it would be a big help. |
@ricea I think I've already signed the CLA; it says I need to be verified? I'll try to get a test submitted today. |
…ion prototype, constructibility, a=testonly Automatic update from web-platform-tests Add tests for QueuingStrategy size function prototype, constructibility See whatwg/streams#1142. -- wpt-commits: c7e9917fc03880d1bb217b99119a3c5d0fe65810 wpt-pr: 29555
…ion prototype, constructibility, a=testonly Automatic update from web-platform-tests Add tests for QueuingStrategy size function prototype, constructibility See whatwg/streams#1142. -- wpt-commits: c7e9917fc03880d1bb217b99119a3c5d0fe65810 wpt-pr: 29555
The reference implementation uses
function
expressions to create thesize()
functions forCountQueuingStrategy
andByteLengthQueuingStrategy
, which results in them being constructible and havingprototype
properties. This PR changes to using arrow functions to better conform to the spec; see original discussion below: