Nicolò Ribaudo 34937f13d5
Trailing comma after rest - The final fix (#10491)
* [parser] Track trailing commas in extras instead of state

* Update existing tests

* Update test262 whitelist

* Improve error message and location

* nit

* Use lookaheadCharCode
2019-10-08 23:08:50 +02:00

295 lines
6.9 KiB
JSON

{
"type": "File",
"start": 0,
"end": 69,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 6,
"column": 18
}
},
"program": {
"type": "Program",
"start": 0,
"end": 69,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 6,
"column": 18
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "VariableDeclaration",
"start": 0,
"end": 69,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 6,
"column": 18
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 6,
"end": 68,
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 6,
"column": 17
}
},
"id": {
"type": "ObjectPattern",
"start": 6,
"end": 52,
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 6,
"column": 1
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 22,
"end": 23,
"loc": {
"start": {
"line": 3,
"column": 2
},
"end": {
"line": 3,
"column": 3
}
},
"method": false,
"key": {
"type": "Identifier",
"start": 22,
"end": 23,
"loc": {
"start": {
"line": 3,
"column": 2
},
"end": {
"line": 3,
"column": 3
},
"identifierName": "x"
},
"name": "x"
},
"computed": false,
"shorthand": true,
"value": {
"type": "Identifier",
"start": 22,
"end": 23,
"loc": {
"start": {
"line": 3,
"column": 2
},
"end": {
"line": 3,
"column": 3
},
"identifierName": "x"
},
"name": "x"
},
"leadingComments": [
{
"type": "CommentBlock",
"value": " One ",
"start": 10,
"end": 19,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 11
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": " Two ",
"start": 26,
"end": 35,
"loc": {
"start": {
"line": 4,
"column": 2
},
"end": {
"line": 4,
"column": 11
}
}
},
{
"type": "CommentBlock",
"value": " Three ",
"start": 39,
"end": 50,
"loc": {
"start": {
"line": 5,
"column": 2
},
"end": {
"line": 5,
"column": 13
}
}
}
],
"extra": {
"shorthand": true
}
}
],
"extra": {
"trailingComma": 35
},
"trailingComments": [
{
"type": "CommentBlock",
"value": " Four ",
"start": 53,
"end": 63,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 12
}
}
}
]
},
"init": {
"type": "ObjectExpression",
"start": 66,
"end": 68,
"loc": {
"start": {
"line": 6,
"column": 15
},
"end": {
"line": 6,
"column": 17
}
},
"properties": []
}
}
],
"kind": "const"
}
],
"directives": []
},
"comments": [
{
"type": "CommentBlock",
"value": " One ",
"start": 10,
"end": 19,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 11
}
}
},
{
"type": "CommentBlock",
"value": " Two ",
"start": 26,
"end": 35,
"loc": {
"start": {
"line": 4,
"column": 2
},
"end": {
"line": 4,
"column": 11
}
}
},
{
"type": "CommentBlock",
"value": " Three ",
"start": 39,
"end": 50,
"loc": {
"start": {
"line": 5,
"column": 2
},
"end": {
"line": 5,
"column": 13
}
}
},
{
"type": "CommentBlock",
"value": " Four ",
"start": 53,
"end": 63,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 12
}
}
}
]
}