Recover from "missing semicolon" errors (#12437)
* Recover from "missing semicolon" errors * Update other tests * Fix flow * Fix windows test * Add back deleted test
This commit is contained in:
parent
2ea0a5d021
commit
8cf0a757d5
@ -1 +1 @@
|
||||
SyntaxError: <CWD>\test.js: Unexpected token, expected ";" (2:10)
|
||||
SyntaxError: <CWD>\test.js: Missing semicolon (2:10)
|
||||
|
||||
@ -1 +1 @@
|
||||
SyntaxError: <CWD>/test.js: Unexpected token, expected ";" (2:10)
|
||||
SyntaxError: <CWD>/test.js: Missing semicolon (2:10)
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (2:10)"
|
||||
"throws": "Missing semicolon (2:10)"
|
||||
}
|
||||
|
||||
@ -99,6 +99,7 @@ export const ErrorMessages = Object.freeze({
|
||||
MissingClassName: "A class name is required",
|
||||
MissingEqInAssignment:
|
||||
"Only '=' operator can be used for specifying default value.",
|
||||
MissingSemicolon: "Missing semicolon",
|
||||
MissingUnicodeEscape: "Expecting Unicode escape sequence \\uXXXX",
|
||||
MixingCoalesceWithLogical:
|
||||
"Nullish coalescing operator(??) requires parens when mixing with logical operators",
|
||||
|
||||
@ -915,9 +915,9 @@ export default class StatementParser extends ExpressionParser {
|
||||
init: ?(N.VariableDeclaration | N.Expression),
|
||||
): N.ForStatement {
|
||||
node.init = init;
|
||||
this.expect(tt.semi);
|
||||
this.semicolon(/* allowAsi */ false);
|
||||
node.test = this.match(tt.semi) ? null : this.parseExpression();
|
||||
this.expect(tt.semi);
|
||||
this.semicolon(/* allowAsi */ false);
|
||||
node.update = this.match(tt.parenR) ? null : this.parseExpression();
|
||||
this.expect(tt.parenR);
|
||||
|
||||
|
||||
@ -105,8 +105,9 @@ export default class UtilParser extends Tokenizer {
|
||||
// Consume a semicolon, or, failing that, see if we are allowed to
|
||||
// pretend that there is a semicolon at this position.
|
||||
|
||||
semicolon(): void {
|
||||
if (!this.isLineTerminator()) this.unexpected(null, tt.semi);
|
||||
semicolon(allowAsi: boolean = true): void {
|
||||
if (allowAsi ? this.isLineTerminator() : this.eat(tt.semi)) return;
|
||||
this.raise(this.state.lastTokEnd, Errors.MissingSemicolon);
|
||||
}
|
||||
|
||||
// Expect a token of a given type. If found, consume it, otherwise,
|
||||
|
||||
7
packages/babel-parser/test/fixtures/core/categorized/for-missing-semicolons/input.js
vendored
Normal file
7
packages/babel-parser/test/fixtures/core/categorized/for-missing-semicolons/input.js
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
for (
|
||||
var a = 1
|
||||
a < 3
|
||||
a++
|
||||
) {
|
||||
|
||||
}
|
||||
82
packages/babel-parser/test/fixtures/core/categorized/for-missing-semicolons/output.json
vendored
Normal file
82
packages/babel-parser/test/fixtures/core/categorized/for-missing-semicolons/output.json
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (2:11)",
|
||||
"SyntaxError: Missing semicolon (3:7)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ForStatement",
|
||||
"start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}},
|
||||
"init": {
|
||||
"type": "VariableDeclaration",
|
||||
"start":8,"end":17,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":12,"end":17,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":11}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":12,"end":13,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"a"},
|
||||
"name": "a"
|
||||
},
|
||||
"init": {
|
||||
"type": "NumericLiteral",
|
||||
"start":16,"end":17,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}},
|
||||
"extra": {
|
||||
"rawValue": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"value": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "var"
|
||||
},
|
||||
"test": {
|
||||
"type": "BinaryExpression",
|
||||
"start":20,"end":25,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":7}},
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":20,"end":21,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"a"},
|
||||
"name": "a"
|
||||
},
|
||||
"operator": "<",
|
||||
"right": {
|
||||
"type": "NumericLiteral",
|
||||
"start":24,"end":25,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":7}},
|
||||
"extra": {
|
||||
"rawValue": 3,
|
||||
"raw": "3"
|
||||
},
|
||||
"value": 3
|
||||
}
|
||||
},
|
||||
"update": {
|
||||
"type": "UpdateExpression",
|
||||
"start":28,"end":31,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":5}},
|
||||
"operator": "++",
|
||||
"prefix": false,
|
||||
"argument": {
|
||||
"type": "Identifier",
|
||||
"start":28,"end":29,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":3},"identifierName":"a"},
|
||||
"name": "a"
|
||||
}
|
||||
},
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":34,"end":38,"loc":{"start":{"line":5,"column":2},"end":{"line":7,"column":1}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:2)"
|
||||
}
|
||||
42
packages/babel-parser/test/fixtures/core/regression/octal-float-fail/output.json
vendored
Normal file
42
packages/babel-parser/test/fixtures/core/regression/octal-float-fail/output.json
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:2)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}},
|
||||
"expression": {
|
||||
"type": "NumericLiteral",
|
||||
"start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}},
|
||||
"extra": {
|
||||
"rawValue": 7,
|
||||
"raw": "07"
|
||||
},
|
||||
"value": 7
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":2,"end":4,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":4}},
|
||||
"expression": {
|
||||
"type": "NumericLiteral",
|
||||
"start":2,"end":4,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":4}},
|
||||
"extra": {
|
||||
"rawValue": 0.5,
|
||||
"raw": ".5"
|
||||
},
|
||||
"value": 0.5
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:6)"
|
||||
}
|
||||
45
packages/babel-parser/test/fixtures/core/uncategorised/388/output.json
vendored
Normal file
45
packages/babel-parser/test/fixtures/core/uncategorised/388/output.json
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:5)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "BlockStatement",
|
||||
"start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5},"identifierName":"set"},
|
||||
"name": "set"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}},
|
||||
"expression": {
|
||||
"type": "NumericLiteral",
|
||||
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}},
|
||||
"extra": {
|
||||
"rawValue": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"value": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:6)"
|
||||
}
|
||||
45
packages/babel-parser/test/fixtures/core/uncategorised/389/output.json
vendored
Normal file
45
packages/babel-parser/test/fixtures/core/uncategorised/389/output.json
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:5)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "BlockStatement",
|
||||
"start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5},"identifierName":"get"},
|
||||
"name": "get"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}},
|
||||
"expression": {
|
||||
"type": "NumericLiteral",
|
||||
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}},
|
||||
"extra": {
|
||||
"rawValue": 2,
|
||||
"raw": "2"
|
||||
},
|
||||
"value": 2
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:2)"
|
||||
}
|
||||
34
packages/babel-parser/test/fixtures/core/uncategorised/405/output.json
vendored
Normal file
34
packages/babel-parser/test/fixtures/core/uncategorised/405/output.json
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:1)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"},
|
||||
"name": "a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":2,"end":4,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":4}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"b"},
|
||||
"name": "b"
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:2)"
|
||||
"throws": "Unexpected token, expected \"(\" (1:4)"
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:2)"
|
||||
"throws": "A class name is required (1:7)"
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:15)"
|
||||
"throws": "Unexpected token (1:15)"
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:14)"
|
||||
"throws": "Unexpected token (1:14)"
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:9)"
|
||||
"throws": "Unexpected token (1:9)"
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:8)"
|
||||
"throws": "Unexpected token (1:9)"
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:9)"
|
||||
"throws": "Unexpected token (1:9)"
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:7)"
|
||||
}
|
||||
42
packages/babel-parser/test/fixtures/es2015/for-of/invalid-escape-of/output.json
vendored
Normal file
42
packages/babel-parser/test/fixtures/es2015/for-of/invalid-escape-of/output.json
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:6)",
|
||||
"SyntaxError: Missing semicolon (1:14)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ForStatement",
|
||||
"start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}},
|
||||
"init": {
|
||||
"type": "Identifier",
|
||||
"start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"},
|
||||
"name": "x"
|
||||
},
|
||||
"test": {
|
||||
"type": "Identifier",
|
||||
"start":7,"end":14,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":14},"identifierName":"of"},
|
||||
"name": "of"
|
||||
},
|
||||
"update": {
|
||||
"type": "Identifier",
|
||||
"start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"y"},
|
||||
"name": "y"
|
||||
},
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:9)"
|
||||
}
|
||||
48
packages/babel-parser/test/fixtures/es2015/let/invalid-escape/output.json
vendored
Normal file
48
packages/babel-parser/test/fixtures/es2015/let/invalid-escape/output.json
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:8)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"let"},
|
||||
"name": "let"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}},
|
||||
"expression": {
|
||||
"type": "AssignmentExpression",
|
||||
"start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"},
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "NumericLiteral",
|
||||
"start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}},
|
||||
"extra": {
|
||||
"rawValue": 5,
|
||||
"raw": "5"
|
||||
},
|
||||
"value": 5
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:9)"
|
||||
}
|
||||
43
packages/babel-parser/test/fixtures/es2015/statements/label-invalid-let/output.json
vendored
Normal file
43
packages/babel-parser/test/fixtures/es2015/statements/label-invalid-let/output.json
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:8)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "LabeledStatement",
|
||||
"start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}},
|
||||
"body": {
|
||||
"type": "ExpressionStatement",
|
||||
"start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"let"},
|
||||
"name": "let"
|
||||
}
|
||||
},
|
||||
"label": {
|
||||
"type": "Identifier",
|
||||
"start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"bar"},
|
||||
"name": "bar"
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (2:4)"
|
||||
}
|
||||
43
packages/babel-parser/test/fixtures/es2015/uncategorised/224/output.json
vendored
Normal file
43
packages/babel-parser/test/fixtures/es2015/uncategorised/224/output.json
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (2:3)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":5}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"},
|
||||
"name": "x"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":4,"end":6,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":3}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":4,"end":6,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":3},"identifierName":"is"},
|
||||
"name": "is"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":7,"end":8,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":7,"end":8,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"y"},
|
||||
"name": "y"
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (2:6)"
|
||||
}
|
||||
43
packages/babel-parser/test/fixtures/es2015/uncategorised/225/output.json
vendored
Normal file
43
packages/babel-parser/test/fixtures/es2015/uncategorised/225/output.json
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":7}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (2:5)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":7}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"},
|
||||
"name": "x"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":4,"end":8,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":5}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":4,"end":8,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":5},"identifierName":"isnt"},
|
||||
"name": "isnt"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":9,"end":10,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":9,"end":10,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"y"},
|
||||
"name": "y"
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:11)"
|
||||
}
|
||||
62
packages/babel-parser/test/fixtures/es2015/uncategorised/328/output.json
vendored
Normal file
62
packages/babel-parser/test/fixtures/es2015/uncategorised/328/output.json
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:10)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "IfStatement",
|
||||
"start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}},
|
||||
"test": {
|
||||
"type": "NumericLiteral",
|
||||
"start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}},
|
||||
"extra": {
|
||||
"rawValue": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"value": 1
|
||||
},
|
||||
"consequent": {
|
||||
"type": "ExpressionStatement",
|
||||
"start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10},"identifierName":"let"},
|
||||
"name": "let"
|
||||
}
|
||||
},
|
||||
"alternate": null
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":11,"end":18,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":18}},
|
||||
"expression": {
|
||||
"type": "AssignmentExpression",
|
||||
"start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"},
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "NumericLiteral",
|
||||
"start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}},
|
||||
"extra": {
|
||||
"rawValue": 10,
|
||||
"raw": "10"
|
||||
},
|
||||
"value": 10
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:6)"
|
||||
}
|
||||
38
packages/babel-parser/test/fixtures/es2015/yield/in-global-scope/output.json
vendored
Normal file
38
packages/babel-parser/test/fixtures/es2015/yield/in-global-scope/output.json
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:5)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"yield"},
|
||||
"name": "yield"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}},
|
||||
"expression": {
|
||||
"type": "NumericLiteral",
|
||||
"start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}},
|
||||
"extra": {
|
||||
"rawValue": 10,
|
||||
"raw": "10"
|
||||
},
|
||||
"value": 10
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:21)"
|
||||
}
|
||||
61
packages/babel-parser/test/fixtures/es2015/yield/in-plain-function/output.json
vendored
Normal file
61
packages/babel-parser/test/fixtures/es2015/yield/in-plain-function/output.json
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:20)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},
|
||||
"expression": {
|
||||
"type": "FunctionExpression",
|
||||
"start":1,"end":25,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":25}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 0
|
||||
},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":13,"end":25,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":25}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20},"identifierName":"yield"},
|
||||
"name": "yield"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}},
|
||||
"expression": {
|
||||
"type": "NumericLiteral",
|
||||
"start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}},
|
||||
"extra": {
|
||||
"rawValue": 10,
|
||||
"raw": "10"
|
||||
},
|
||||
"value": 10
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (2:8)"
|
||||
"throws": "Unexpected token (2:8)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:12)"
|
||||
"throws": "Unexpected token (1:12)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:16)"
|
||||
"throws": "Unexpected token (1:16)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (2:4)"
|
||||
"throws": "Unexpected token (2:4)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:14)"
|
||||
"throws": "Unexpected token (1:15)"
|
||||
}
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:31)"
|
||||
}
|
||||
58
packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-await/output.json
vendored
Normal file
58
packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-await/output.json
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}},
|
||||
"errors": [
|
||||
"SyntaxError: Can not use 'await' as identifier inside an async function (1:20)",
|
||||
"SyntaxError: Missing semicolon (1:30)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}},
|
||||
"expression": {
|
||||
"type": "FunctionExpression",
|
||||
"start":1,"end":34,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":34}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 0
|
||||
},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": true,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":18,"end":34,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":34}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30},"identifierName":"await"},
|
||||
"name": "await"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"x"},
|
||||
"name": "x"
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:26)"
|
||||
"sourceType": "module"
|
||||
}
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:25)",
|
||||
"SyntaxError: 'await' is only allowed within async functions (1:41)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}},
|
||||
"sourceType": "module",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExportDefaultDeclaration",
|
||||
"start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}},
|
||||
"declaration": {
|
||||
"type": "Identifier",
|
||||
"start":15,"end":25,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":25},"identifierName":"async"},
|
||||
"name": "async"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "FunctionDeclaration",
|
||||
"start":26,"end":50,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":50}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"y"},
|
||||
"name": "y"
|
||||
},
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":39,"end":50,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":50}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":41,"end":48,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":48}},
|
||||
"expression": {
|
||||
"type": "AwaitExpression",
|
||||
"start":41,"end":48,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":48}},
|
||||
"argument": {
|
||||
"type": "Identifier",
|
||||
"start":47,"end":48,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":48},"identifierName":"x"},
|
||||
"name": "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:11)"
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:10)",
|
||||
"SyntaxError: 'await' is only allowed within async functions (1:18)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10},"identifierName":"async"},
|
||||
"name": "async"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":11,"end":27,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":27}},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start":11,"end":27,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":27}},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"},
|
||||
"name": "x"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":16,"end":27,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":27}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":18,"end":25,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":25}},
|
||||
"expression": {
|
||||
"type": "AwaitExpression",
|
||||
"start":18,"end":25,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":25}},
|
||||
"argument": {
|
||||
"type": "Identifier",
|
||||
"start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"x"},
|
||||
"name": "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:11)"
|
||||
"throws": "Unexpected token (1:19)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:11)"
|
||||
"throws": "Unexpected token (1:11)"
|
||||
}
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:8)"
|
||||
}
|
||||
53
packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-func/output.json
vendored
Normal file
53
packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-func/output.json
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:7)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":1,"end":6,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":6},"identifierName":"async"},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 0
|
||||
},
|
||||
"name": "async"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "FunctionDeclaration",
|
||||
"start":8,"end":25,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":25}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"x"},
|
||||
"name": "x"
|
||||
},
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21},"identifierName":"a"},
|
||||
"name": "a"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"sourceType": "module",
|
||||
"throws": "Unexpected token, expected \";\" (1:17)"
|
||||
"throws": "Unexpected token (1:18)"
|
||||
}
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:14)"
|
||||
}
|
||||
53
packages/babel-parser/test/fixtures/esprima/es2015-for-of/unexpected-number/output.json
vendored
Normal file
53
packages/babel-parser/test/fixtures/esprima/es2015-for-of/unexpected-number/output.json
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}},
|
||||
"errors": [
|
||||
"SyntaxError: Const declarations require an initialization value (1:13)",
|
||||
"SyntaxError: Missing semicolon (1:13)",
|
||||
"SyntaxError: Missing semicolon (1:16)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ForStatement",
|
||||
"start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}},
|
||||
"init": {
|
||||
"type": "VariableDeclaration",
|
||||
"start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13}},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13},"identifierName":"of"},
|
||||
"name": "of"
|
||||
},
|
||||
"init": null
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
},
|
||||
"test": {
|
||||
"type": "NumericLiteral",
|
||||
"start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}},
|
||||
"extra": {
|
||||
"rawValue": 42,
|
||||
"raw": "42"
|
||||
},
|
||||
"value": 42
|
||||
},
|
||||
"update": null,
|
||||
"body": {
|
||||
"type": "EmptyStatement",
|
||||
"start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:20)"
|
||||
}
|
||||
61
packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-expression/output.json
vendored
Normal file
61
packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-expression/output.json
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:19)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}},
|
||||
"expression": {
|
||||
"type": "FunctionExpression",
|
||||
"start":1,"end":24,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":24}},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 0
|
||||
},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":12,"end":24,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":24}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19},"identifierName":"yield"},
|
||||
"name": "yield"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}},
|
||||
"expression": {
|
||||
"type": "NumericLiteral",
|
||||
"start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}},
|
||||
"extra": {
|
||||
"rawValue": 3,
|
||||
"raw": "3"
|
||||
},
|
||||
"value": 3
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:28)"
|
||||
"throws": "Unexpected token (1:28)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:2)"
|
||||
"throws": "Unexpected token (1:2)"
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:6)"
|
||||
}
|
||||
45
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0071/output.json
vendored
Normal file
45
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0071/output.json
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:5)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "BlockStatement",
|
||||
"start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5},"identifierName":"set"},
|
||||
"name": "set"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}},
|
||||
"expression": {
|
||||
"type": "NumericLiteral",
|
||||
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}},
|
||||
"extra": {
|
||||
"rawValue": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"value": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:6)"
|
||||
}
|
||||
45
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0072/output.json
vendored
Normal file
45
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0072/output.json
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:5)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "BlockStatement",
|
||||
"start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5},"identifierName":"get"},
|
||||
"name": "get"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}},
|
||||
"expression": {
|
||||
"type": "NumericLiteral",
|
||||
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}},
|
||||
"extra": {
|
||||
"rawValue": 2,
|
||||
"raw": "2"
|
||||
},
|
||||
"value": 2
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:2)"
|
||||
}
|
||||
34
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0112/output.json
vendored
Normal file
34
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0112/output.json
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:1)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"},
|
||||
"name": "a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":2,"end":4,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":4}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"b"},
|
||||
"name": "b"
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:2)"
|
||||
"throws": "Unexpected token, expected \"(\" (1:4)"
|
||||
}
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:2)"
|
||||
}
|
||||
35
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0115/output.json
vendored
Normal file
35
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0115/output.json
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:1)",
|
||||
"SyntaxError: Unexpected reserved word 'enum' (1:2)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"},
|
||||
"name": "a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":2,"end":7,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":7}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":2,"end":6,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":6},"identifierName":"enum"},
|
||||
"name": "enum"
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:15)"
|
||||
"throws": "Unexpected token (1:15)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:14)"
|
||||
"throws": "Unexpected token (1:14)"
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:13)"
|
||||
}
|
||||
58
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0141/output.json
vendored
Normal file
58
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0141/output.json
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:12)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "IfStatement",
|
||||
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
|
||||
"test": {
|
||||
"type": "BooleanLiteral",
|
||||
"start":3,"end":7,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":7}},
|
||||
"value": true
|
||||
},
|
||||
"consequent": {
|
||||
"type": "ExpressionStatement",
|
||||
"start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"let"},
|
||||
"name": "let"
|
||||
}
|
||||
},
|
||||
"alternate": null
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}},
|
||||
"expression": {
|
||||
"type": "AssignmentExpression",
|
||||
"start":13,"end":18,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":18}},
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"a"},
|
||||
"name": "a"
|
||||
},
|
||||
"right": {
|
||||
"type": "NumericLiteral",
|
||||
"start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}},
|
||||
"extra": {
|
||||
"rawValue": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"value": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:16)"
|
||||
}
|
||||
49
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0257/output.json
vendored
Normal file
49
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0257/output.json
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:15)",
|
||||
"SyntaxError: Unexpected reserved word 'package' (1:16)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"a"},
|
||||
"name": "a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":16,"end":23,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":23}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":16,"end":23,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":23},"identifierName":"package"},
|
||||
"name": "package"
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": [
|
||||
{
|
||||
"type": "Directive",
|
||||
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
|
||||
"value": {
|
||||
"type": "DirectiveLiteral",
|
||||
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
|
||||
"extra": {
|
||||
"raw": "'use strict'",
|
||||
"rawValue": "use strict"
|
||||
},
|
||||
"value": "use strict"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (3:8)",
|
||||
"throws": "Unexpected token (3:8)",
|
||||
"plugins": ["classPrivateProperties"]
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (3:9)",
|
||||
"throws": "Unexpected token (3:9)",
|
||||
"plugins": ["classProperties"]
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (3:8)",
|
||||
"throws": "Unexpected token (3:8)",
|
||||
"plugins": ["classProperties"]
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
{
|
||||
"plugins": [
|
||||
"classStaticBlock"
|
||||
],
|
||||
"throws": "Unexpected token, expected \";\" (5:12)"
|
||||
]
|
||||
}
|
||||
102
packages/babel-parser/test/fixtures/experimental/class-static-block/invalid-yield/output.json
vendored
Normal file
102
packages/babel-parser/test/fixtures/experimental/class-static-block/invalid-yield/output.json
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":90,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":1}},
|
||||
"errors": [
|
||||
"SyntaxError: Unexpected reserved word 'yield' (5:6)",
|
||||
"SyntaxError: Missing semicolon (5:11)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":90,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":1}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "FunctionDeclaration",
|
||||
"start":0,"end":90,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":1}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"generator": true,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":16,"end":90,"loc":{"start":{"line":1,"column":16},"end":{"line":8,"column":1}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassDeclaration",
|
||||
"start":20,"end":88,"loc":{"start":{"line":2,"column":2},"end":{"line":7,"column":3}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":26,"end":27,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"C"},
|
||||
"name": "C"
|
||||
},
|
||||
"superClass": null,
|
||||
"body": {
|
||||
"type": "ClassBody",
|
||||
"start":28,"end":88,"loc":{"start":{"line":2,"column":10},"end":{"line":7,"column":3}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ClassMethod",
|
||||
"start":34,"end":49,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":19}},
|
||||
"static": true,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":41,"end":44,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":14},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"computed": false,
|
||||
"kind": "method",
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":47,"end":49,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":19}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "StaticBlock",
|
||||
"start":54,"end":84,"loc":{"start":{"line":4,"column":4},"end":{"line":6,"column":5}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":69,"end":74,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":11}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":69,"end":74,"loc":{"start":{"line":5,"column":6},"end":{"line":5,"column":11},"identifierName":"yield"},
|
||||
"name": "yield"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":75,"end":78,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":15}},
|
||||
"expression": {
|
||||
"type": "NumericLiteral",
|
||||
"start":75,"end":77,"loc":{"start":{"line":5,"column":12},"end":{"line":5,"column":14}},
|
||||
"extra": {
|
||||
"rawValue": 42,
|
||||
"raw": "42"
|
||||
},
|
||||
"value": 42
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,3 @@
|
||||
{
|
||||
"plugins": ["functionSent"],
|
||||
"throws": "Unexpected token, expected \";\" (2:18)"
|
||||
"plugins": ["functionSent"]
|
||||
}
|
||||
|
||||
@ -0,0 +1,64 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (2:17)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "FunctionDeclaration",
|
||||
"start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"generator": true,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":16,"end":40,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":1}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":20,"end":35,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}},
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"start":20,"end":35,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}},
|
||||
"callee": {
|
||||
"type": "MetaProperty",
|
||||
"start":20,"end":33,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}},
|
||||
"meta": {
|
||||
"type": "Identifier",
|
||||
"start":20,"end":28,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10},"identifierName":"function"},
|
||||
"name": "function"
|
||||
},
|
||||
"property": {
|
||||
"type": "Identifier",
|
||||
"start":29,"end":33,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":15},"identifierName":"sent"},
|
||||
"name": "sent"
|
||||
}
|
||||
},
|
||||
"arguments": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "BlockStatement",
|
||||
"start":36,"end":38,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":20}},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,5 @@
|
||||
"importAssertions"
|
||||
]
|
||||
],
|
||||
"sourceType": "module",
|
||||
"throws": "Unexpected token, expected \";\" (1:13)"
|
||||
"sourceType": "module"
|
||||
}
|
||||
|
||||
@ -0,0 +1,74 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:12)",
|
||||
"SyntaxError: Missing semicolon (1:24)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}},
|
||||
"sourceType": "module",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ImportDeclaration",
|
||||
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
|
||||
"specifiers": [],
|
||||
"source": {
|
||||
"type": "StringLiteral",
|
||||
"start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}},
|
||||
"extra": {
|
||||
"rawValue": "foo",
|
||||
"raw": "\"foo\""
|
||||
},
|
||||
"value": "foo"
|
||||
},
|
||||
"assertions": []
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24},"identifierName":"assert"},
|
||||
"name": "assert"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "BlockStatement",
|
||||
"start":25,"end":41,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":41}},
|
||||
"body": [
|
||||
{
|
||||
"type": "LabeledStatement",
|
||||
"start":27,"end":39,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":39}},
|
||||
"body": {
|
||||
"type": "ExpressionStatement",
|
||||
"start":33,"end":39,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":39}},
|
||||
"expression": {
|
||||
"type": "StringLiteral",
|
||||
"start":33,"end":39,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":39}},
|
||||
"extra": {
|
||||
"rawValue": "json",
|
||||
"raw": "\"json\""
|
||||
},
|
||||
"value": "json"
|
||||
}
|
||||
},
|
||||
"label": {
|
||||
"type": "Identifier",
|
||||
"start":27,"end":31,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":31},"identifierName":"type"},
|
||||
"name": "type"
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
{
|
||||
"type": "EmptyStatement",
|
||||
"start":41,"end":42,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":42}}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,5 @@
|
||||
"importAssertions"
|
||||
]
|
||||
],
|
||||
"sourceType": "module",
|
||||
"throws": "Unexpected token, expected \";\" (2:15)"
|
||||
"sourceType": "module"
|
||||
}
|
||||
@ -0,0 +1,106 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":39}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (2:14)",
|
||||
"SyntaxError: Missing semicolon (2:21)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":39}},
|
||||
"sourceType": "module",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start":6,"end":13,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":13}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"init": {
|
||||
"type": "NumericLiteral",
|
||||
"start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}},
|
||||
"extra": {
|
||||
"rawValue": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"value": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
},
|
||||
{
|
||||
"type": "ExportNamedDeclaration",
|
||||
"start":15,"end":29,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}},
|
||||
"specifiers": [
|
||||
{
|
||||
"type": "ExportSpecifier",
|
||||
"start":24,"end":27,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12}},
|
||||
"local": {
|
||||
"type": "Identifier",
|
||||
"start":24,"end":27,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
},
|
||||
"exported": {
|
||||
"type": "Identifier",
|
||||
"start":24,"end":27,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
}
|
||||
}
|
||||
],
|
||||
"source": null,
|
||||
"declaration": null
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":30,"end":36,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":21}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":30,"end":36,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":21},"identifierName":"assert"},
|
||||
"name": "assert"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "BlockStatement",
|
||||
"start":37,"end":53,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":38}},
|
||||
"body": [
|
||||
{
|
||||
"type": "LabeledStatement",
|
||||
"start":39,"end":51,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":36}},
|
||||
"body": {
|
||||
"type": "ExpressionStatement",
|
||||
"start":45,"end":51,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":36}},
|
||||
"expression": {
|
||||
"type": "StringLiteral",
|
||||
"start":45,"end":51,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":36}},
|
||||
"extra": {
|
||||
"rawValue": "json",
|
||||
"raw": "\"json\""
|
||||
},
|
||||
"value": "json"
|
||||
}
|
||||
},
|
||||
"label": {
|
||||
"type": "Identifier",
|
||||
"start":39,"end":43,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":28},"identifierName":"type"},
|
||||
"name": "type"
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
{
|
||||
"type": "EmptyStatement",
|
||||
"start":53,"end":54,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":39}}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,3 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "fsharp" }]],
|
||||
"throws": "Unexpected token, expected \";\" (2:20)"
|
||||
"plugins": [["pipelineOperator", { "proposal": "fsharp" }]]
|
||||
}
|
||||
|
||||
@ -0,0 +1,62 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (2:19)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "FunctionDeclaration",
|
||||
"start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start":15,"end":19,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":19},"identifierName":"test"},
|
||||
"name": "test"
|
||||
},
|
||||
"generator": false,
|
||||
"async": true,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start":23,"end":49,"loc":{"start":{"line":1,"column":23},"end":{"line":3,"column":1}},
|
||||
"body": [
|
||||
{
|
||||
"type": "ReturnStatement",
|
||||
"start":27,"end":44,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":19}},
|
||||
"argument": {
|
||||
"type": "BinaryExpression",
|
||||
"start":34,"end":44,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":19}},
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start":34,"end":35,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"x"},
|
||||
"name": "x"
|
||||
},
|
||||
"operator": "|>",
|
||||
"right": {
|
||||
"type": "AwaitExpression",
|
||||
"start":39,"end":44,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":19}}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":45,"end":47,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":22}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":45,"end":46,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":21},"identifierName":"f"},
|
||||
"name": "f"
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "minimal" }]],
|
||||
"throws": "Unexpected token, expected \";\" (1:10)"
|
||||
"throws": "Unexpected token (1:10)"
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "minimal" }]],
|
||||
"throws": "Unexpected token, expected \";\" (1:8)"
|
||||
"throws": "Unexpected token (1:8)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:27)"
|
||||
"throws": "Unexpected token (1:27)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:36)"
|
||||
"throws": "Unexpected token (1:36)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:29)"
|
||||
"throws": "Unexpected token (1:29)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:38)"
|
||||
"throws": "Unexpected token (1:38)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:30)"
|
||||
"throws": "Unexpected token (1:30)"
|
||||
}
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:27)"
|
||||
}
|
||||
44
packages/babel-parser/test/fixtures/flow/declare-export/invalid-export-default-var/output.json
vendored
Normal file
44
packages/babel-parser/test/fixtures/flow/declare-export/invalid-export-default-var/output.json
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:26)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}},
|
||||
"sourceType": "module",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "DeclareExportDeclaration",
|
||||
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},
|
||||
"declaration": {
|
||||
"type": "Identifier",
|
||||
"start":23,"end":26,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":26},"identifierName":"var"},
|
||||
"name": "var"
|
||||
},
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"type": "LabeledStatement",
|
||||
"start":27,"end":36,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":36}},
|
||||
"body": {
|
||||
"type": "ExpressionStatement",
|
||||
"start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36},"identifierName":"number"},
|
||||
"name": "number"
|
||||
}
|
||||
},
|
||||
"label": {
|
||||
"type": "Identifier",
|
||||
"start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"a"},
|
||||
"name": "a"
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:8)"
|
||||
}
|
||||
38
packages/babel-parser/test/fixtures/flow/declare-statements/invalid-literal/output.json
vendored
Normal file
38
packages/babel-parser/test/fixtures/flow/declare-statements/invalid-literal/output.json
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}},
|
||||
"errors": [
|
||||
"SyntaxError: Missing semicolon (1:7)"
|
||||
],
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}},
|
||||
"sourceType": "module",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}},
|
||||
"expression": {
|
||||
"type": "Identifier",
|
||||
"start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"declare"},
|
||||
"name": "declare"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":8,"end":10,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":10}},
|
||||
"expression": {
|
||||
"type": "NumericLiteral",
|
||||
"start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}},
|
||||
"extra": {
|
||||
"rawValue": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"value": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user