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

278 lines
6.0 KiB
JSON

{
"type": "File",
"start": 0,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 7,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 7,
"column": 1
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 1
}
},
"expression": {
"type": "AssignmentExpression",
"start": 0,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 1
}
},
"operator": "=",
"left": {
"type": "Identifier",
"start": 0,
"end": 1,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 1
},
"identifierName": "A"
},
"name": "A"
},
"right": {
"type": "ObjectExpression",
"start": 4,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 4,
"column": 1
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 8,
"end": 13,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 7
}
},
"method": false,
"key": {
"type": "Identifier",
"start": 8,
"end": 9,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 3
},
"identifierName": "a"
},
"name": "a"
},
"computed": false,
"shorthand": false,
"value": {
"type": "NumericLiteral",
"start": 11,
"end": 13,
"loc": {
"start": {
"line": 2,
"column": 5
},
"end": {
"line": 2,
"column": 7
}
},
"extra": {
"rawValue": 42,
"raw": "42"
},
"value": 42
},
"trailingComments": [
{
"type": "CommentLine",
"value": " One",
"start": 17,
"end": 23,
"loc": {
"start": {
"line": 3,
"column": 2
},
"end": {
"line": 3,
"column": 8
}
}
}
]
}
],
"extra": {
"trailingComma": 13
}
}
},
"trailingComments": [
{
"type": "CommentLine",
"value": " Two",
"start": 27,
"end": 33,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 6
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 34,
"end": 35,
"loc": {
"start": {
"line": 7,
"column": 0
},
"end": {
"line": 7,
"column": 1
}
},
"expression": {
"type": "Identifier",
"start": 34,
"end": 35,
"loc": {
"start": {
"line": 7,
"column": 0
},
"end": {
"line": 7,
"column": 1
},
"identifierName": "B"
},
"name": "B"
},
"leadingComments": [
{
"type": "CommentLine",
"value": " Two",
"start": 27,
"end": 33,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 6
}
}
}
]
}
],
"directives": []
},
"comments": [
{
"type": "CommentLine",
"value": " One",
"start": 17,
"end": 23,
"loc": {
"start": {
"line": 3,
"column": 2
},
"end": {
"line": 3,
"column": 8
}
}
},
{
"type": "CommentLine",
"value": " Two",
"start": 27,
"end": 33,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 6
}
}
}
]
}