Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

Temporary rollback for erroring on trailing comma with spread #154

Merged
merged 1 commit into from
Oct 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/parser/expression.js
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,9 @@ pp.parseObj = function (isPattern, refShorthandDefaultPos) {
} else if (this.eat(tt.braceR)) {
break;
} else if (this.match(tt.comma) && this.lookahead().type === tt.braceR) {
this.unexpected(position, "A trailing comma is not permitted after the rest element");
// TODO: temporary rollback
// this.unexpected(position, "A trailing comma is not permitted after the rest element");
continue;
} else {
firstRestLocation = position;
continue;
Expand Down
243 changes: 243 additions & 0 deletions test/fixtures/experimental/object-rest-spread/8/expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
{
"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": []
}
}
3 changes: 0 additions & 3 deletions test/fixtures/experimental/object-rest-spread/8/options.json

This file was deleted.