Recover from error for missing initializer in const declaration (#12120)
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:7)"
|
||||
}
|
||||
33
packages/babel-parser/test/fixtures/core/uncategorised/536/output.json
vendored
Normal file
33
packages/babel-parser/test/fixtures/core/uncategorised/536/output.json
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}},
|
||||
"errors": [
|
||||
"SyntaxError: Const declarations require an initialization value (1:7)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"a"},
|
||||
"name": "a"
|
||||
},
|
||||
"init": null
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:14)"
|
||||
}
|
||||
"throws": "Unexpected token, expected \";\" (1:14)"
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:15)"
|
||||
}
|
||||
51
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0138/output.json
vendored
Normal file
51
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0138/output.json
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||
"errors": [
|
||||
"SyntaxError: Const declarations require an initialization value (1:15)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"},
|
||||
"name": "x"
|
||||
},
|
||||
"init": {
|
||||
"type": "NumericLiteral",
|
||||
"start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}},
|
||||
"extra": {
|
||||
"rawValue": 12,
|
||||
"raw": "12"
|
||||
},
|
||||
"value": 12
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"y"},
|
||||
"name": "y"
|
||||
},
|
||||
"init": null
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:7)"
|
||||
}
|
||||
51
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0139/output.json
vendored
Normal file
51
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0139/output.json
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||
"errors": [
|
||||
"SyntaxError: Const declarations require an initialization value (1:7)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"},
|
||||
"name": "x"
|
||||
},
|
||||
"init": null
|
||||
},
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"y"},
|
||||
"name": "y"
|
||||
},
|
||||
"init": {
|
||||
"type": "NumericLiteral",
|
||||
"start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}},
|
||||
"extra": {
|
||||
"rawValue": 12,
|
||||
"raw": "12"
|
||||
},
|
||||
"value": 12
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:7)"
|
||||
}
|
||||
33
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0140/output.json
vendored
Normal file
33
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0140/output.json
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}},
|
||||
"errors": [
|
||||
"SyntaxError: Const declarations require an initialization value (1:7)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"},
|
||||
"name": "x"
|
||||
},
|
||||
"init": null
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user