From 58284c500214cf61595cb8aef15e6aae012e41a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alu=C3=ADsio=20Augusto=20Silva=20Gon=C3=A7alves?= Date: Mon, 6 Apr 2015 09:10:44 -0300 Subject: [PATCH] [ES7] Trailing comma in function parameter list Currenly a stage 1 proposal. See https://github.com/jeffmo/es-trailing-function-commas. --- src/expression.js | 2 +- src/statement.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/expression.js b/src/expression.js index d1d0b7457a..7662b4cdba 100755 --- a/src/expression.js +++ b/src/expression.js @@ -224,7 +224,7 @@ pp.parseSubscripts = function(base, start, noCalls) { } else if (!noCalls && this.eat(tt.parenL)) { let node = this.startNodeAt(start) node.callee = base - node.arguments = this.parseExprList(tt.parenR, false) + node.arguments = this.parseExprList(tt.parenR, this.options.features["es7.trailingFunctionCommas"]) return this.parseSubscripts(this.finishNode(node, "CallExpression"), start, noCalls) } else if (this.type === tt.backQuote) { let node = this.startNodeAt(start) diff --git a/src/statement.js b/src/statement.js index 08ae517d3d..2a73536bca 100755 --- a/src/statement.js +++ b/src/statement.js @@ -458,7 +458,7 @@ pp.parseFunction = function(node, isStatement, allowExpressionBody, isAsync) { pp.parseFunctionParams = function(node) { this.expect(tt.parenL) - node.params = this.parseBindingList(tt.parenR, false, false) + node.params = this.parseBindingList(tt.parenR, false, this.options.features["es7.trailingFunctionCommas"]) } // Parse a class declaration or literal (depending on the