Nicolò Ribaudo 87feda7c2a
@babel/parser error recovery (#10363)
* Add error recovery support to @babel/parser

* Update @babel/parser tests to always recover from errors

* Update this.raise usage in @babel/parser:

- expression.js
- lval.js
- statement.js
- estree.js
- flow.js
- jsx/index.js
- tokenizer/index.js

* Update @babel/parser fixtures with recovered errors

* Fix tests out of @babel/parser

* Do not use try/catch for control flow

* Update invalid fixtures

* Do not report invalid lhs in toAssignable

* Do not validate function id multiple times

* Dedupe reserved await errors

* Remove duplicate errors about strict reserved bindings

* Remove duplicated error about yield/await inside params

* Don't error twice for methods in object patterns

* Don't report invalid super() twice

* Remove dup error about reserved param for expr arrows

* Remove double escapes in migrated tests

* Dedupe errors about invalid escapes in identifiers

* Remove duplicated error about decorated constructor

* Remove duplicated error about spread in flow class

* Don't throw for invalid super usage

* Don't fail for object decorators with stage 2

* Fix flow inexact type errors

* Fix flow

* Fix errors about escapes in keywords (ref: #10455)

* Update after rebase

* Fix todo

* Remove duplicated error when using += for defaults

* Remove unnecessary throw

* Nit: use ??
2019-11-05 10:15:00 +01:00

538 lines
34 KiB
JSON

{
"type": "File",
"start": 0,
"end": 54,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 54
}
},
"errors": [
"SyntaxError: Binding member expression (1:24)"
],
"program": {
"type": "Program",
"start": 0,
"end": 54,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 54
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 54,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 54
}
},
"expression": {
"type": "ArrowFunctionExpression",
"start": 0,
"end": 53,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 53
}
},
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "ArrayPattern",
"start": 1,
"end": 49,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 49
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 2,
"end": 48,
"loc": {
"start": {
"line": 1,
"column": 2
},
"end": {
"line": 1,
"column": 48
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 3,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 3
},
"end": {
"line": 1,
"column": 47
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 4,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 46
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 5,
"end": 45,
"loc": {
"start": {
"line": 1,
"column": 5
},
"end": {
"line": 1,
"column": 45
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 6,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 44
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 7,
"end": 43,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 43
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 8,
"end": 42,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 42
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 9,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 41
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 10,
"end": 40,
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 40
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 11,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 39
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 12,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 38
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 13,
"end": 37,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 37
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 14,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 36
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 15,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 35
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 16,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 34
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 17,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 33
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 18,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 32
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 19,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 31
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 20,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 20
},
"end": {
"line": 1,
"column": 30
}
},
"elements": [
{
"type": "ObjectPattern",
"start": 21,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 29
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 22,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 28
}
},
"method": false,
"key": {
"type": "Identifier",
"start": 22,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 23
},
"identifierName": "a"
},
"name": "a"
},
"computed": false,
"shorthand": false,
"value": {
"type": "MemberExpression",
"start": 24,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 24
},
"end": {
"line": 1,
"column": 28
}
},
"object": {
"type": "Identifier",
"start": 24,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 24
},
"end": {
"line": 1,
"column": 25
},
"identifierName": "b"
},
"name": "b"
},
"property": {
"type": "NumericLiteral",
"start": 26,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 26
},
"end": {
"line": 1,
"column": 27
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
},
"computed": true
}
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
],
"body": {
"type": "NumericLiteral",
"start": 52,
"end": 53,
"loc": {
"start": {
"line": 1,
"column": 52
},
"end": {
"line": 1,
"column": 53
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
}
}
],
"directives": []
}
}