RESOLVED FIXED 162013
test262: Should be a SyntaxError for duplicate parameter names in function with default parameters
https://bugs.webkit.org/show_bug.cgi?id=162013
Summary test262: Should be a SyntaxError for duplicate parameter names in function wi...
Joseph Pecoraro
Reported 2016-09-15 02:08:56 PDT
Summary: Should be a SyntaxError for duplicate parameter names in function with default parameters Currently we only issue a SyntaxError if their is a duplicate name and it or later there is default parameter value: jsc> function f(x, x = 0) {} Duplicate parameter 'x' not allowed in function with default parameter values.:1 We should, but aren't, issuing the same SyntaxError if there is a duplicate name and there was an earlier default parameter values. jsc> function f(x = 0, x) {} undefined We should be issuing a SyntaxError if there is a duplicate name if there are any default parameters. Spec: https://tc39.github.io/ecma262/#sec-function-definitions-static-semantics-early-errors > FormalParameters : FormalParameterList > > It is a Syntax Error if IsSimpleParameterList of FormalParameterList is > false and BoundNames of FormalParameterList contains any duplicate elements. https://tc39.github.io/ecma262/#sec-destructuring-binding-patterns-static-semantics-issimpleparameterlist IsSimpleParameterList is false if the parameter list contains things like any RestParameters, BindingPatterns (destructuring), or BindingIdentifiers with Initialization (default parameters). Notes: - Covered in a bunch of test262 tests, like: test262/test/language/expressions/function/params-dflt-duplicates.js
Attachments
[PATCH] Proposed Fix (8.70 KB, patch)
2016-09-15 02:15 PDT, Joseph Pecoraro
no flags
Joseph Pecoraro
Comment 1 2016-09-15 02:15:28 PDT
Created attachment 288944 [details] [PATCH] Proposed Fix
WebKit Commit Bot
Comment 2 2016-09-15 08:43:03 PDT
Comment on attachment 288944 [details] [PATCH] Proposed Fix Clearing flags on attachment: 288944 Committed r205969: <http://trac.webkit.org/changeset/205969>
WebKit Commit Bot
Comment 3 2016-09-15 08:43:06 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.