diff --git a/src/acorn/src/expression.js b/src/acorn/src/expression.js index 3540956fe3..6b8e842e8d 100755 --- a/src/acorn/src/expression.js +++ b/src/acorn/src/expression.js @@ -474,7 +474,10 @@ pp.parseNew = function() { } let start = this.markPosition() node.callee = this.parseSubscripts(this.parseExprAtom(), start, true) - if (this.eat(tt.parenL)) node.arguments = this.parseExprList(tt.parenR, false) + if (this.eat(tt.parenL)) node.arguments = this.parseExprList( + tt.parenR, + this.options.features["es7.trailingFunctionCommas"] + ) else node.arguments = empty return this.finishNode(node, "NewExpression") } diff --git a/test/core/fixtures/transformation/es7.trailing-function-commas/new-expression/actual.js b/test/core/fixtures/transformation/es7.trailing-function-commas/new-expression/actual.js new file mode 100644 index 0000000000..8b6de60f82 --- /dev/null +++ b/test/core/fixtures/transformation/es7.trailing-function-commas/new-expression/actual.js @@ -0,0 +1 @@ +new Foo(a, b,); diff --git a/test/core/fixtures/transformation/es7.trailing-function-commas/new-expression/expected.js b/test/core/fixtures/transformation/es7.trailing-function-commas/new-expression/expected.js new file mode 100644 index 0000000000..70e032ca1c --- /dev/null +++ b/test/core/fixtures/transformation/es7.trailing-function-commas/new-expression/expected.js @@ -0,0 +1,3 @@ +"use strict"; + +new Foo(a, b);