diff --git a/src/parser/expression.js b/src/parser/expression.js index 9deb74c686..81cb3766ed 100644 --- a/src/parser/expression.js +++ b/src/parser/expression.js @@ -749,9 +749,7 @@ pp.parseObj = function (isPattern, refShorthandDefaultPos) { } else if (this.eat(tt.braceR)) { break; } else if (this.match(tt.comma) && this.lookahead().type === tt.braceR) { - // TODO: temporary rollback - // this.unexpected(position, "A trailing comma is not permitted after the rest element"); - continue; + this.unexpected(position, "A trailing comma is not permitted after the rest element"); } else { firstRestLocation = position; continue; diff --git a/test/fixtures/experimental/object-rest-spread/8/expected.json b/test/fixtures/experimental/object-rest-spread/8/expected.json deleted file mode 100644 index f97a0ab95c..0000000000 --- a/test/fixtures/experimental/object-rest-spread/8/expected.json +++ /dev/null @@ -1,243 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "sourceType": "script", - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 4, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "id": { - "type": "ObjectPattern", - "start": 4, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "properties": [ - { - "type": "ObjectProperty", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, - "name": "x" - }, - "value": { - "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, - "name": "x" - }, - "extra": { - "shorthand": true - } - }, - { - "type": "ObjectProperty", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "y" - }, - "name": "y" - }, - "value": { - "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "y" - }, - "name": "y" - }, - "extra": { - "shorthand": true - } - }, - { - "type": "RestProperty", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "argument": { - "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "z" - }, - "name": "z" - } - } - ] - }, - "init": { - "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "obj" - }, - "name": "obj" - } - } - ], - "kind": "let" - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/experimental/object-rest-spread/8/options.json b/test/fixtures/experimental/object-rest-spread/8/options.json new file mode 100644 index 0000000000..4a97ac85ea --- /dev/null +++ b/test/fixtures/experimental/object-rest-spread/8/options.json @@ -0,0 +1,3 @@ +{ + "throws": "A trailing comma is not permitted after the rest element (1:16)" +}