* 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 ??
504 lines
16 KiB
JSON
504 lines
16 KiB
JSON
{
|
|
"type": "File",
|
|
"start": 0,
|
|
"end": 94,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 67
|
|
}
|
|
},
|
|
"errors": [
|
|
"SyntaxError: Identifier 'foo4' has already been declared (2:49)",
|
|
"SyntaxError: `foo4` has already been exported. Exported identifiers must be unique. (2:49)"
|
|
],
|
|
"program": {
|
|
"type": "Program",
|
|
"start": 0,
|
|
"end": 94,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 67
|
|
}
|
|
},
|
|
"sourceType": "module",
|
|
"interpreter": null,
|
|
"body": [
|
|
{
|
|
"type": "ExportNamedDeclaration",
|
|
"start": 0,
|
|
"end": 25,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 25
|
|
}
|
|
},
|
|
"specifiers": [],
|
|
"source": null,
|
|
"declaration": {
|
|
"type": "FunctionDeclaration",
|
|
"start": 7,
|
|
"end": 25,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 7
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 25
|
|
}
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"start": 16,
|
|
"end": 20,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 16
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 20
|
|
},
|
|
"identifierName": "foo4"
|
|
},
|
|
"name": "foo4"
|
|
},
|
|
"generator": false,
|
|
"async": false,
|
|
"params": [],
|
|
"body": {
|
|
"type": "BlockStatement",
|
|
"start": 23,
|
|
"end": 25,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 23
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 25
|
|
}
|
|
},
|
|
"body": [],
|
|
"directives": []
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "EmptyStatement",
|
|
"start": 25,
|
|
"end": 26,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 25
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 26
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "ExportNamedDeclaration",
|
|
"start": 27,
|
|
"end": 94,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 67
|
|
}
|
|
},
|
|
"specifiers": [],
|
|
"source": null,
|
|
"declaration": {
|
|
"type": "VariableDeclaration",
|
|
"start": 34,
|
|
"end": 94,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 7
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 67
|
|
}
|
|
},
|
|
"declarations": [
|
|
{
|
|
"type": "VariableDeclarator",
|
|
"start": 40,
|
|
"end": 93,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 13
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 66
|
|
}
|
|
},
|
|
"id": {
|
|
"type": "ObjectPattern",
|
|
"start": 40,
|
|
"end": 87,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 13
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 60
|
|
}
|
|
},
|
|
"properties": [
|
|
{
|
|
"type": "ObjectProperty",
|
|
"start": 42,
|
|
"end": 54,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 15
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 27
|
|
}
|
|
},
|
|
"method": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"start": 42,
|
|
"end": 43,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 15
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 16
|
|
},
|
|
"identifierName": "a"
|
|
},
|
|
"name": "a"
|
|
},
|
|
"computed": false,
|
|
"shorthand": false,
|
|
"value": {
|
|
"type": "ArrayPattern",
|
|
"start": 45,
|
|
"end": 54,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 18
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 27
|
|
}
|
|
},
|
|
"elements": [
|
|
{
|
|
"type": "ObjectPattern",
|
|
"start": 46,
|
|
"end": 53,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 19
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 26
|
|
}
|
|
},
|
|
"properties": [
|
|
{
|
|
"type": "ObjectProperty",
|
|
"start": 48,
|
|
"end": 51,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 21
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 24
|
|
}
|
|
},
|
|
"method": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"start": 48,
|
|
"end": 51,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 21
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 24
|
|
},
|
|
"identifierName": "foo"
|
|
},
|
|
"name": "foo"
|
|
},
|
|
"computed": false,
|
|
"shorthand": true,
|
|
"value": {
|
|
"type": "Identifier",
|
|
"start": 48,
|
|
"end": 51,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 21
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 24
|
|
},
|
|
"identifierName": "foo"
|
|
},
|
|
"name": "foo"
|
|
},
|
|
"extra": {
|
|
"shorthand": true
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "ObjectProperty",
|
|
"start": 56,
|
|
"end": 85,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 29
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 58
|
|
}
|
|
},
|
|
"method": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"start": 56,
|
|
"end": 57,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 29
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 30
|
|
},
|
|
"identifierName": "b"
|
|
},
|
|
"name": "b"
|
|
},
|
|
"computed": false,
|
|
"shorthand": false,
|
|
"value": {
|
|
"type": "ObjectPattern",
|
|
"start": 59,
|
|
"end": 85,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 32
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 58
|
|
}
|
|
},
|
|
"properties": [
|
|
{
|
|
"type": "ObjectProperty",
|
|
"start": 61,
|
|
"end": 83,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 34
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 56
|
|
}
|
|
},
|
|
"method": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"start": 61,
|
|
"end": 65,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 34
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 38
|
|
},
|
|
"identifierName": "foo2"
|
|
},
|
|
"name": "foo2"
|
|
},
|
|
"computed": false,
|
|
"shorthand": false,
|
|
"value": {
|
|
"type": "ArrayPattern",
|
|
"start": 67,
|
|
"end": 83,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 40
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 56
|
|
}
|
|
},
|
|
"elements": [
|
|
{
|
|
"type": "ObjectPattern",
|
|
"start": 68,
|
|
"end": 82,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 41
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 55
|
|
}
|
|
},
|
|
"properties": [
|
|
{
|
|
"type": "ObjectProperty",
|
|
"start": 70,
|
|
"end": 80,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 43
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 53
|
|
}
|
|
},
|
|
"method": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"start": 70,
|
|
"end": 74,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 43
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 47
|
|
},
|
|
"identifierName": "foo3"
|
|
},
|
|
"name": "foo3"
|
|
},
|
|
"computed": false,
|
|
"shorthand": false,
|
|
"value": {
|
|
"type": "Identifier",
|
|
"start": 76,
|
|
"end": 80,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 49
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 53
|
|
},
|
|
"identifierName": "foo4"
|
|
},
|
|
"name": "foo4"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"init": {
|
|
"type": "Identifier",
|
|
"start": 90,
|
|
"end": 93,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 63
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 66
|
|
},
|
|
"identifierName": "bar"
|
|
},
|
|
"name": "bar"
|
|
}
|
|
}
|
|
],
|
|
"kind": "const"
|
|
}
|
|
}
|
|
],
|
|
"directives": []
|
|
}
|
|
} |