Summary: | test262: Function length should be number of parameters before parameters with default values | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Joseph Pecoraro <joepeck> | ||||||
Component: | JavaScriptCore | Assignee: | Joseph Pecoraro <joepeck> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | commit-queue, joepeck, keith_miller, mark.lam, msaboff, saam | ||||||
Priority: | P2 | ||||||||
Version: | WebKit Nightly Build | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Attachments: |
|
Description
Joseph Pecoraro
2016-09-22 01:11:32 PDT
Created attachment 289535 [details]
[PATCH] Proposed Fix
Comment on attachment 289535 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=289535&action=review > Source/JavaScriptCore/ChangeLog:19 > + Alongside the parameterCount value, maintain a separate count, > + nonDefaultParameterCount, which will be the count before seeing > + a rest parameter or initialized parameter. Of course after I wrote the patch "nonDefaultParameterCount" is a kind of poor name since (1) you can have non-default-parameters after the first default-parameter and (2) a rest parameter affects this but is not a default parameter. function (a,b=1,c) {} // length === 1 I'm open to better naming suggestions! Here are some suggestions: parameterCountForLength parameterCountForFunctionLength parameterCountBeforeInitializedParameter Comment on attachment 289535 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=289535&action=review r=me > JSTests/stress/es6-default-parameters.js:236 > +function named11(a=1,...b){}; Can you also add a test like: (a=10, b, c=20, ...r) or something similar. >> Source/JavaScriptCore/ChangeLog:19 >> + a rest parameter or initialized parameter. > > Of course after I wrote the patch "nonDefaultParameterCount" is a kind of poor name since (1) you can have non-default-parameters after the first default-parameter and (2) a rest parameter affects this but is not a default parameter. > > function (a,b=1,c) {} // length === 1 > > I'm open to better naming suggestions! > > Here are some suggestions: > > parameterCountForLength > parameterCountForFunctionLength > parameterCountBeforeInitializedParameter Why not just "functionLength"? Created attachment 289589 [details]
[PATCH] For Landing
Comment on attachment 289589 [details] [PATCH] For Landing Clearing flags on attachment: 289589 Committed r206268: <http://trac.webkit.org/changeset/206268> |