Allow trailing commas in function parameter lists
Add a flag harmony_trailing_commas_in_parameters that allows trailing commas in function parameter declaration lists and function call parameter lists. Trailing commas are allowed in parenthetical lists like `(a, b, c,)` only if the next token is `=>`, thereby making it an arrow function declaration. Only 1 trailing comma is allowed, not `(a,,)`. A trailing comma must follow a non-rest parameter, so `(,)` and `(...a,)` are still SyntaxErrors. However, a trailing comma is allowed after a spread parameter, e.g. `a(...b,);`. Add parser tests for all of the above. BUG=v8:5051 LOG=y Review-Url: https://codereview.chromium.org/2094463002 Cr-Commit-Position: refs/heads/master@{#37355}
Showing
Please
register
or
sign in
to comment