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
Created attachment 288944 [details] [PATCH] Proposed Fix
Comment on attachment 288944 [details] [PATCH] Proposed Fix Clearing flags on attachment: 288944 Committed r205969: <http://trac.webkit.org/changeset/205969>
All reviewed patches have been landed. Closing bug.