-
Notifications
You must be signed in to change notification settings - Fork 861
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
Adds support for trailing commas in function parameters #1416
Adds support for trailing commas in function parameters #1416
Conversation
@@ -6151,8 +6145,8 @@ language/statements/generators 220/259 (84.94%) | |||
param-dflt-yield.js {unsupported: [default-parameters]} | |||
params-dflt-args-unmapped.js {unsupported: [default-parameters]} | |||
params-dflt-ref-arguments.js {unsupported: [default-parameters]} | |||
params-trailing-comma-multiple.js | |||
params-trailing-comma-single.js | |||
params-trailing-comma-multiple.js non-interpreted |
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.
Does this mean it fails in compiled mode?
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.
The testcase fails due to #1412 now, but the params-trailing-comma part is fixed
Do you want rhino/src/org/mozilla/javascript/ast/FunctionNode.java Lines 392 to 394 in a3f43df
|
20aebd4
to
7072014
Compare
I guess we should? Added it now, but done so by 'tagging' the FunctionNode with an int property, but I wonder if I should instead add some getter/setter combo on FunctionNode. Thoughts? |
7072014
to
3be3add
Compare
Thank you! Looking good!
As I read the code, |
Tnx. Just FYI: 'TRAILING_COMMA' is only set on ParenthesizedExpression to carry it forward to where the ParenthesizedExpression is used to construct the params of an Arrow function |
@@ -3160,16 +3171,20 @@ private AstNode parenExpr() throws IOException { | |||
Comment jsdocNode = getAndResetJsDoc(); | |||
int lineno = ts.lineno; | |||
int begin = ts.tokenBeg; | |||
AstNode e = (peekToken() == Token.RP ? new EmptyExpression(begin) : expr()); | |||
AstNode e = (peekToken() == Token.RP ? new EmptyExpression(begin) : expr(true)); |
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.
To my points above, if this is the only place where we pass "true," does it make more sense to add a new function instead?
As the title says
BTW think this ought to be a squashed merge