diff --git a/packages/babel-cli/test/fixtures/babel/stdin --filename windows/stderr.txt b/packages/babel-cli/test/fixtures/babel/stdin --filename windows/stderr.txt index 1ca69db108..b4566e9fe6 100644 --- a/packages/babel-cli/test/fixtures/babel/stdin --filename windows/stderr.txt +++ b/packages/babel-cli/test/fixtures/babel/stdin --filename windows/stderr.txt @@ -1 +1 @@ -SyntaxError: \test.js: Unexpected token, expected ";" (2:10) +SyntaxError: \test.js: Missing semicolon (2:10) diff --git a/packages/babel-cli/test/fixtures/babel/stdin --filename/stderr.txt b/packages/babel-cli/test/fixtures/babel/stdin --filename/stderr.txt index 460f1fc729..a2d3423157 100644 --- a/packages/babel-cli/test/fixtures/babel/stdin --filename/stderr.txt +++ b/packages/babel-cli/test/fixtures/babel/stdin --filename/stderr.txt @@ -1 +1 @@ -SyntaxError: /test.js: Unexpected token, expected ";" (2:10) +SyntaxError: /test.js: Missing semicolon (2:10) diff --git a/packages/babel-core/test/fixtures/transformation/errors/syntax/options.json b/packages/babel-core/test/fixtures/transformation/errors/syntax/options.json index 0a96acde2e..937e44f2f4 100644 --- a/packages/babel-core/test/fixtures/transformation/errors/syntax/options.json +++ b/packages/babel-core/test/fixtures/transformation/errors/syntax/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (2:10)" + "throws": "Missing semicolon (2:10)" } diff --git a/packages/babel-parser/src/parser/error-message.js b/packages/babel-parser/src/parser/error-message.js index 90df3c5f38..3325c074dc 100644 --- a/packages/babel-parser/src/parser/error-message.js +++ b/packages/babel-parser/src/parser/error-message.js @@ -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", diff --git a/packages/babel-parser/src/parser/statement.js b/packages/babel-parser/src/parser/statement.js index 5827e5154a..0f4c9ed409 100644 --- a/packages/babel-parser/src/parser/statement.js +++ b/packages/babel-parser/src/parser/statement.js @@ -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); diff --git a/packages/babel-parser/src/parser/util.js b/packages/babel-parser/src/parser/util.js index 9244cc983e..5dbf618ee4 100644 --- a/packages/babel-parser/src/parser/util.js +++ b/packages/babel-parser/src/parser/util.js @@ -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, diff --git a/packages/babel-parser/test/fixtures/core/categorized/for-missing-semicolons/input.js b/packages/babel-parser/test/fixtures/core/categorized/for-missing-semicolons/input.js new file mode 100644 index 0000000000..8f16e39960 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/for-missing-semicolons/input.js @@ -0,0 +1,7 @@ +for ( + var a = 1 + a < 3 + a++ +) { + +} diff --git a/packages/babel-parser/test/fixtures/core/categorized/for-missing-semicolons/output.json b/packages/babel-parser/test/fixtures/core/categorized/for-missing-semicolons/output.json new file mode 100644 index 0000000000..ed05439af7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/for-missing-semicolons/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/regression/octal-float-fail/options.json b/packages/babel-parser/test/fixtures/core/regression/octal-float-fail/options.json deleted file mode 100644 index a89de70c61..0000000000 --- a/packages/babel-parser/test/fixtures/core/regression/octal-float-fail/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/core/regression/octal-float-fail/output.json b/packages/babel-parser/test/fixtures/core/regression/octal-float-fail/output.json new file mode 100644 index 0000000000..34bb9d3431 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/regression/octal-float-fail/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/388/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/388/options.json deleted file mode 100644 index c4c1edaca3..0000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/388/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/388/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/388/output.json new file mode 100644 index 0000000000..ec9f3f126a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/388/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/389/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/389/options.json deleted file mode 100644 index c4c1edaca3..0000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/389/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/389/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/389/output.json new file mode 100644 index 0000000000..eb17665ab7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/389/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/405/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/405/options.json deleted file mode 100644 index a89de70c61..0000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/405/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/405/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/405/output.json new file mode 100644 index 0000000000..9f46d8a53e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/405/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/407/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/407/options.json index a89de70c61..01bcb0a20e 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/407/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/407/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:2)" -} + "throws": "Unexpected token, expected \"(\" (1:4)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/408/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/408/options.json index a89de70c61..9f6ece53f3 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/408/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/408/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:2)" -} + "throws": "A class name is required (1:7)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/415/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/415/options.json index a717ca0fa7..7ca1e1ffbb 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/415/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/415/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:15)" -} + "throws": "Unexpected token (1:15)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/416/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/416/options.json index 6079f56395..51c483f3d3 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/416/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/416/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:14)" -} + "throws": "Unexpected token (1:14)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/arrow-functions/no-binary-left/options.json b/packages/babel-parser/test/fixtures/es2015/arrow-functions/no-binary-left/options.json index e4ae9a99d0..93db7641c7 100644 --- a/packages/babel-parser/test/fixtures/es2015/arrow-functions/no-binary-left/options.json +++ b/packages/babel-parser/test/fixtures/es2015/arrow-functions/no-binary-left/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:9)" -} + "throws": "Unexpected token (1:9)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/arrow-functions/no-callee/options.json b/packages/babel-parser/test/fixtures/es2015/arrow-functions/no-callee/options.json index cf30cd9156..93db7641c7 100644 --- a/packages/babel-parser/test/fixtures/es2015/arrow-functions/no-callee/options.json +++ b/packages/babel-parser/test/fixtures/es2015/arrow-functions/no-callee/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:8)" -} + "throws": "Unexpected token (1:9)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/arrow-functions/no-ternary-test/options.json b/packages/babel-parser/test/fixtures/es2015/arrow-functions/no-ternary-test/options.json index e4ae9a99d0..93db7641c7 100644 --- a/packages/babel-parser/test/fixtures/es2015/arrow-functions/no-ternary-test/options.json +++ b/packages/babel-parser/test/fixtures/es2015/arrow-functions/no-ternary-test/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:9)" -} + "throws": "Unexpected token (1:9)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-of/invalid-escape-of/options.json b/packages/babel-parser/test/fixtures/es2015/for-of/invalid-escape-of/options.json deleted file mode 100644 index 8678455a0f..0000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-of/invalid-escape-of/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/for-of/invalid-escape-of/output.json b/packages/babel-parser/test/fixtures/es2015/for-of/invalid-escape-of/output.json new file mode 100644 index 0000000000..5b248b94f2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-of/invalid-escape-of/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/invalid-escape/options.json b/packages/babel-parser/test/fixtures/es2015/let/invalid-escape/options.json deleted file mode 100644 index e4ae9a99d0..0000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/invalid-escape/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/let/invalid-escape/output.json b/packages/babel-parser/test/fixtures/es2015/let/invalid-escape/output.json new file mode 100644 index 0000000000..481ab58d62 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/invalid-escape/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-let/options.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-let/options.json deleted file mode 100644 index e4ae9a99d0..0000000000 --- a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-let/output.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-let/output.json new file mode 100644 index 0000000000..f9826760ea --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-let/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/224/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/224/options.json deleted file mode 100644 index cd6a9c1b1a..0000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/224/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/224/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/224/output.json new file mode 100644 index 0000000000..5596ed9f78 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/224/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/225/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/225/options.json deleted file mode 100644 index 42e596c50c..0000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/225/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/225/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/225/output.json new file mode 100644 index 0000000000..4cd6d09cff --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/225/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/328/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/328/options.json deleted file mode 100644 index b98beb8359..0000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/328/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/328/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/328/output.json new file mode 100644 index 0000000000..71a9cb4c65 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/328/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/in-global-scope/options.json b/packages/babel-parser/test/fixtures/es2015/yield/in-global-scope/options.json deleted file mode 100644 index c4c1edaca3..0000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/in-global-scope/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/in-global-scope/output.json b/packages/babel-parser/test/fixtures/es2015/yield/in-global-scope/output.json new file mode 100644 index 0000000000..2a5530c8fc --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/in-global-scope/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/in-plain-function/options.json b/packages/babel-parser/test/fixtures/es2015/yield/in-plain-function/options.json deleted file mode 100644 index 63364a8e47..0000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/in-plain-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/in-plain-function/output.json b/packages/babel-parser/test/fixtures/es2015/yield/in-plain-function/output.json new file mode 100644 index 0000000000..45281e703a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/in-plain-function/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-no-parens-inside-generator/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-no-parens-inside-generator/options.json index 659fa230c4..ef2b7c682f 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-no-parens-inside-generator/options.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-no-parens-inside-generator/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (2:8)" + "throws": "Unexpected token (2:8)" } diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-after-binary-operator/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-after-binary-operator/options.json index 663c136985..9e093bfdcd 100644 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-after-binary-operator/options.json +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-after-binary-operator/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:12)" + "throws": "Unexpected token (1:12)" } diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-after-unary-operator/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-after-unary-operator/options.json index 715f71e32a..4c07f39d17 100644 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-after-unary-operator/options.json +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function-after-unary-operator/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:16)" + "throws": "Unexpected token (1:16)" } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/10/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/10/options.json index cd6a9c1b1a..b2f4797ad8 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/10/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/10/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (2:4)" + "throws": "Unexpected token (2:4)" } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/6/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/6/options.json index 6079f56395..98d7123790 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/6/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/6/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:14)" + "throws": "Unexpected token (1:15)" } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-await/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-await/options.json deleted file mode 100644 index 1cd92c2a1f..0000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-await/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:31)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-await/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-await/output.json new file mode 100644 index 0000000000..7a89909179 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-await/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-dflt-async-function/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-dflt-async-function/options.json index 1e18128833..2104ca4328 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-dflt-async-function/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-dflt-async-function/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:26)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-dflt-async-function/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-dflt-async-function/output.json new file mode 100644 index 0000000000..93d68bf0ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-dflt-async-function/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow/options.json deleted file mode 100644 index b98beb8359..0000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow/output.json new file mode 100644 index 0000000000..66a170b05a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function-list/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function-list/options.json index 99a2bc92f2..0cd8225707 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function-list/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function-list/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \",\" (1:12)" -} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function/options.json index b98beb8359..d5583f7bc5 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:11)" + "throws": "Unexpected token (1:19)" } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-arrow/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-arrow/options.json index b98beb8359..cb6c66081e 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-arrow/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-arrow/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:11)" + "throws": "Unexpected token (1:11)" } diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-func/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-func/options.json deleted file mode 100644 index cf30cd9156..0000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-func/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-func/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-func/output.json new file mode 100644 index 0000000000..456b35386a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-func/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-default-token/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-default-token/options.json index 8c1430963e..9bc4a478b7 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-default-token/options.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-default-token/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "throws": "Unexpected token, expected \";\" (1:17)" + "throws": "Unexpected token (1:18)" } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/unexpected-number/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/unexpected-number/options.json deleted file mode 100644 index c83e2245d0..0000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/unexpected-number/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:14)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/unexpected-number/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/unexpected-number/output.json new file mode 100644 index 0000000000..5259253cdf --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/unexpected-number/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-expression/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-expression/options.json deleted file mode 100644 index 640cd6c71b..0000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-expression/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-expression/output.json new file mode 100644 index 0000000000..4ec3bf958e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-expression/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-member-expression/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-member-expression/options.json index f3780bda31..c7dd7266de 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-member-expression/options.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-member-expression/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:28)" + "throws": "Unexpected token (1:28)" } diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0065/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0065/options.json index ff1ac8247e..e68fbb6aec 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0065/options.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0065/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:2)" + "throws": "Unexpected token (1:2)" } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0071/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0071/options.json deleted file mode 100644 index c4c1edaca3..0000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0071/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0071/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0071/output.json new file mode 100644 index 0000000000..ec9f3f126a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0071/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0072/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0072/options.json deleted file mode 100644 index c4c1edaca3..0000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0072/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0072/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0072/output.json new file mode 100644 index 0000000000..eb17665ab7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0072/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0112/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0112/options.json deleted file mode 100644 index a89de70c61..0000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0112/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0112/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0112/output.json new file mode 100644 index 0000000000..9f46d8a53e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0112/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0114/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0114/options.json index a89de70c61..40babbccd7 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0114/options.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0114/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:2)" + "throws": "Unexpected token, expected \"(\" (1:4)" } diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0115/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0115/options.json deleted file mode 100644 index a89de70c61..0000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0115/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0115/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0115/output.json new file mode 100644 index 0000000000..3b44c2aa68 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0115/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0123/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0123/options.json index a717ca0fa7..98d7123790 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0123/options.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0123/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:15)" + "throws": "Unexpected token (1:15)" } diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0124/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0124/options.json index 6079f56395..51c483f3d3 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0124/options.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0124/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:14)" -} + "throws": "Unexpected token (1:14)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0141/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0141/options.json deleted file mode 100644 index a74ca2305e..0000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0141/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0141/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0141/output.json new file mode 100644 index 0000000000..607bb08d2c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0141/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0257/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0257/options.json deleted file mode 100644 index 715f71e32a..0000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0257/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0257/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0257/output.json new file mode 100644 index 0000000000..1e257d6d4e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0257/output.json @@ -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" + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/asi-failure-generator/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/asi-failure-generator/options.json index b30a668734..ed9a49a3e5 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-properties/asi-failure-generator/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/asi-failure-generator/options.json @@ -1,4 +1,4 @@ { - "throws": "Unexpected token, expected \";\" (3:8)", + "throws": "Unexpected token (3:8)", "plugins": ["classPrivateProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/asi-failure-computed/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/asi-failure-computed/options.json index add4733dab..0c58f8ded1 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/asi-failure-computed/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/asi-failure-computed/options.json @@ -1,4 +1,4 @@ { - "throws": "Unexpected token, expected \";\" (3:9)", + "throws": "Unexpected token (3:9)", "plugins": ["classProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/asi-failure-generator/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/asi-failure-generator/options.json index 075e6cdf9d..2a095c57b8 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/asi-failure-generator/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/asi-failure-generator/options.json @@ -1,4 +1,4 @@ { - "throws": "Unexpected token, expected \";\" (3:8)", + "throws": "Unexpected token (3:8)", "plugins": ["classProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-static-block/invalid-yield/options.json b/packages/babel-parser/test/fixtures/experimental/class-static-block/invalid-yield/options.json index ed5be518c9..9e18fa8acf 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-static-block/invalid-yield/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-static-block/invalid-yield/options.json @@ -1,6 +1,5 @@ { "plugins": [ "classStaticBlock" - ], - "throws": "Unexpected token, expected \";\" (5:12)" + ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-static-block/invalid-yield/output.json b/packages/babel-parser/test/fixtures/experimental/class-static-block/invalid-yield/output.json new file mode 100644 index 0000000000..a88cd81ff0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-static-block/invalid-yield/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-function-keyword-declaration/options.json b/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-function-keyword-declaration/options.json index c35c6b64ea..fea46c76c3 100644 --- a/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-function-keyword-declaration/options.json +++ b/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-function-keyword-declaration/options.json @@ -1,4 +1,3 @@ { - "plugins": ["functionSent"], - "throws": "Unexpected token, expected \";\" (2:18)" + "plugins": ["functionSent"] } diff --git a/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-function-keyword-declaration/output.json b/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-function-keyword-declaration/output.json new file mode 100644 index 0000000000..eaab0f905b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/function-sent/enabled-function-keyword-declaration/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/import-assertions/invalid-escaped-assert/options.json b/packages/babel-parser/test/fixtures/experimental/import-assertions/invalid-escaped-assert/options.json index d534a0e8c8..94e3f37425 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-assertions/invalid-escaped-assert/options.json +++ b/packages/babel-parser/test/fixtures/experimental/import-assertions/invalid-escaped-assert/options.json @@ -4,6 +4,5 @@ "importAssertions" ] ], - "sourceType": "module", - "throws": "Unexpected token, expected \";\" (1:13)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/experimental/import-assertions/invalid-escaped-assert/output.json b/packages/babel-parser/test/fixtures/experimental/import-assertions/invalid-escaped-assert/output.json new file mode 100644 index 0000000000..31284550fd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/import-assertions/invalid-escaped-assert/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/import-assertions/invalid-export-without-from/options.json b/packages/babel-parser/test/fixtures/experimental/import-assertions/invalid-export-without-from/options.json index 83c4e5f4a8..dbfe1111af 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-assertions/invalid-export-without-from/options.json +++ b/packages/babel-parser/test/fixtures/experimental/import-assertions/invalid-export-without-from/options.json @@ -4,6 +4,5 @@ "importAssertions" ] ], - "sourceType": "module", - "throws": "Unexpected token, expected \";\" (2:15)" + "sourceType": "module" } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/import-assertions/invalid-export-without-from/output.json b/packages/babel-parser/test/fixtures/experimental/import-assertions/invalid-export-without-from/output.json new file mode 100644 index 0000000000..682ac330eb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/import-assertions/invalid-export-without-from/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-ban-await-f/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-ban-await-f/options.json index b743604f7e..f95ecc7d6c 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-ban-await-f/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-ban-await-f/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "fsharp" }]], - "throws": "Unexpected token, expected \";\" (2:20)" + "plugins": [["pipelineOperator", { "proposal": "fsharp" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-ban-await-f/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-ban-await-f/output.json new file mode 100644 index 0000000000..f62c456f95 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-fsharp-ban-await-f/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-arrow-requires-parens-with-parend-args/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-arrow-requires-parens-with-parend-args/options.json index a281f6face..fd0619ea6c 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-arrow-requires-parens-with-parend-args/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-arrow-requires-parens-with-parend-args/options.json @@ -1,4 +1,4 @@ { "plugins": [["pipelineOperator", { "proposal": "minimal" }]], - "throws": "Unexpected token, expected \";\" (1:10)" + "throws": "Unexpected token (1:10)" } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-arrow-requires-parens/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-arrow-requires-parens/options.json index c89b7d0c25..a5f924f6a6 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-arrow-requires-parens/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-minimal-arrow-requires-parens/options.json @@ -1,4 +1,4 @@ { "plugins": [["pipelineOperator", { "proposal": "minimal" }]], - "throws": "Unexpected token, expected \";\" (1:8)" + "throws": "Unexpected token (1:8)" } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/bad_01/options.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/bad_01/options.json index bdbbf5a8ee..40affc8da5 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/bad_01/options.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/bad_01/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:27)" + "throws": "Unexpected token (1:27)" } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/bad_02/options.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/bad_02/options.json index e49fcc05ad..4914c41568 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/bad_02/options.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/bad_02/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:36)" + "throws": "Unexpected token (1:36)" } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/bad_01/options.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/bad_01/options.json index afeae0c7e8..6079f138a6 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/bad_01/options.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/bad_01/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:29)" + "throws": "Unexpected token (1:29)" } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/bad_02/options.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/bad_02/options.json index 4e633917c4..64ee32f318 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/bad_02/options.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/bad_02/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:38)" + "throws": "Unexpected token (1:38)" } diff --git a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/bad_03/options.json b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/bad_03/options.json index ff9c4d1990..c87b29dd4d 100644 --- a/packages/babel-parser/test/fixtures/flow/anonymous-function-types/bad_03/options.json +++ b/packages/babel-parser/test/fixtures/flow/anonymous-function-types/bad_03/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:30)" + "throws": "Unexpected token (1:30)" } diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/invalid-export-default-var/options.json b/packages/babel-parser/test/fixtures/flow/declare-export/invalid-export-default-var/options.json deleted file mode 100644 index bdbbf5a8ee..0000000000 --- a/packages/babel-parser/test/fixtures/flow/declare-export/invalid-export-default-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:27)" -} diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/invalid-export-default-var/output.json b/packages/babel-parser/test/fixtures/flow/declare-export/invalid-export-default-var/output.json new file mode 100644 index 0000000000..79403b71b3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/declare-export/invalid-export-default-var/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/invalid-literal/options.json b/packages/babel-parser/test/fixtures/flow/declare-statements/invalid-literal/options.json deleted file mode 100644 index cf30cd9156..0000000000 --- a/packages/babel-parser/test/fixtures/flow/declare-statements/invalid-literal/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/flow/declare-statements/invalid-literal/output.json b/packages/babel-parser/test/fixtures/flow/declare-statements/invalid-literal/output.json new file mode 100644 index 0000000000..6418fa0d75 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/declare-statements/invalid-literal/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/declare_opaque/options.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/declare_opaque/options.json index c6a890932c..562afcef48 100644 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/declare_opaque/options.json +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/declare_opaque/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:23)" + "throws": "Unexpected token (1:23)" } diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_export_t_and_st/options.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_export_t_and_st/options.json index e49fcc05ad..4914c41568 100644 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_export_t_and_st/options.json +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_export_t_and_st/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:36)" + "throws": "Unexpected token (1:36)" } diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_export_t_no_st/options.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_export_t_no_st/options.json index 1cd92c2a1f..c7bcd3fc1a 100644 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_export_t_no_st/options.json +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_export_t_no_st/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:31)" + "throws": "Unexpected token (1:31)" } diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_t_and_st/options.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_t_and_st/options.json index afeae0c7e8..6079f138a6 100644 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_t_and_st/options.json +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_t_and_st/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:29)" + "throws": "Unexpected token (1:29)" } diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_t_no_st/options.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_t_no_st/options.json index b8eb9b6900..fa579aa831 100644 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_t_no_st/options.json +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_declare_t_no_st/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:24)" + "throws": "Unexpected token (1:24)" } diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_invalid_decl2/options.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_invalid_decl2/options.json index ff9c4d1990..c87b29dd4d 100644 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_invalid_decl2/options.json +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_invalid_decl2/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:30)" + "throws": "Unexpected token (1:30)" } diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_subtype_allow_export/input.js b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_subtype_allow_export/input.js index 270b9f19fe..4d98fbf1c9 100644 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_subtype_allow_export/input.js +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_subtype_allow_export/input.js @@ -1,3 +1,3 @@ declare module 'foo' { - declare export opaque type MyType: number = string; + declare export opaque type MyType: number; } diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_subtype_allow_export/options.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_subtype_allow_export/options.json deleted file mode 100644 index 96f24ac821..0000000000 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_subtype_allow_export/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (2:44)" -} diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_subtype_allow_export/output.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_subtype_allow_export/output.json new file mode 100644 index 0000000000..0f6e676bdd --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_subtype_allow_export/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareModule", + "start":0,"end":69,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "StringLiteral", + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "extra": { + "rawValue": "foo", + "raw": "'foo'" + }, + "value": "foo" + }, + "body": { + "type": "BlockStatement", + "start":21,"end":69,"loc":{"start":{"line":1,"column":21},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "DeclareExportDeclaration", + "start":25,"end":67,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":44}}, + "declaration": { + "type": "DeclareOpaqueType", + "start":40,"end":67,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":44}}, + "id": { + "type": "Identifier", + "start":52,"end":58,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":35},"identifierName":"MyType"}, + "name": "MyType" + }, + "typeParameters": null, + "supertype": { + "type": "NumberTypeAnnotation", + "start":60,"end":66,"loc":{"start":{"line":2,"column":37},"end":{"line":2,"column":43}} + }, + "impltype": null + }, + "default": false + } + ] + }, + "kind": "ES" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_type_allow_export/input.js b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_type_allow_export/input.js index 2fb871dbf1..f4443c93c2 100644 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_type_allow_export/input.js +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_type_allow_export/input.js @@ -1,3 +1,3 @@ declare module 'foo' { - declare export opaque type MyType = string; + declare export opaque type MyType; } diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_type_allow_export/options.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_type_allow_export/options.json deleted file mode 100644 index aa195086ef..0000000000 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_type_allow_export/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (2:36)" -} diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_type_allow_export/output.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_type_allow_export/output.json new file mode 100644 index 0000000000..6235ce32c4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/opaque_type_allow_export/output.json @@ -0,0 +1,50 @@ +{ + "type": "File", + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareModule", + "start":0,"end":61,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "StringLiteral", + "start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, + "extra": { + "rawValue": "foo", + "raw": "'foo'" + }, + "value": "foo" + }, + "body": { + "type": "BlockStatement", + "start":21,"end":61,"loc":{"start":{"line":1,"column":21},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "DeclareExportDeclaration", + "start":25,"end":59,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":36}}, + "declaration": { + "type": "DeclareOpaqueType", + "start":40,"end":59,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":36}}, + "id": { + "type": "Identifier", + "start":52,"end":58,"loc":{"start":{"line":2,"column":29},"end":{"line":2,"column":35},"identifierName":"MyType"}, + "name": "MyType" + }, + "typeParameters": null, + "supertype": null, + "impltype": null + }, + "default": false + } + ] + }, + "kind": "ES" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/options.json index 3c7c9c589b..aa49bf8b97 100644 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/options.json +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/options.json @@ -4,5 +4,5 @@ "flow", "optionalChaining" ], - "throws": "Unexpected token, expected \";\" (1:21)" + "throws": "Unexpected token (1:21)" } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/placeholders/arrow/async-parenless/options.json b/packages/babel-parser/test/fixtures/placeholders/arrow/async-parenless/options.json index 91e2a8bf91..85fa68b7d6 100644 --- a/packages/babel-parser/test/fixtures/placeholders/arrow/async-parenless/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/arrow/async-parenless/options.json @@ -1,4 +1,4 @@ { "plugins": ["placeholders"], - "throws": "Unexpected token, expected \";\" (1:6)" + "throws": "Unexpected token (1:16)" } diff --git a/packages/babel-parser/test/fixtures/placeholders/arrow/sync-parenless/options.json b/packages/babel-parser/test/fixtures/placeholders/arrow/sync-parenless/options.json index c2a8ef725f..c6e654a28b 100644 --- a/packages/babel-parser/test/fixtures/placeholders/arrow/sync-parenless/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/arrow/sync-parenless/options.json @@ -1,4 +1,4 @@ { "plugins": ["placeholders"], - "throws": "Unexpected token, expected \";\" (1:10)" + "throws": "Unexpected token (1:10)" } diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/async-arrow-function-after-binary-operator/options.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-arrow-function-after-binary-operator/options.json index 90cd707a26..e087fe9bb4 100644 --- a/packages/babel-parser/test/fixtures/typescript/arrow-function/async-arrow-function-after-binary-operator/options.json +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/async-arrow-function-after-binary-operator/options.json @@ -1,5 +1,5 @@ { "sourceType": "module", "plugins": ["typescript"], - "throws": "Unexpected token, expected \";\" (1:20)" + "throws": "Unexpected token (1:20)" } diff --git a/packages/babel-parser/test/fixtures/typescript/class/property-optional-definite-assignment-not-allowed/options.json b/packages/babel-parser/test/fixtures/typescript/class/property-optional-definite-assignment-not-allowed/options.json index cd6a9c1b1a..b2f4797ad8 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/property-optional-definite-assignment-not-allowed/options.json +++ b/packages/babel-parser/test/fixtures/typescript/class/property-optional-definite-assignment-not-allowed/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (2:4)" + "throws": "Unexpected token (2:4)" } diff --git a/packages/babel-parser/test/fixtures/typescript/interface/new-line-error/options.json b/packages/babel-parser/test/fixtures/typescript/interface/new-line-error/options.json deleted file mode 100644 index d36d386ca0..0000000000 --- a/packages/babel-parser/test/fixtures/typescript/interface/new-line-error/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/interface/new-line-error/output.json b/packages/babel-parser/test/fixtures/typescript/interface/new-line-error/output.json new file mode 100644 index 0000000000..f379134be8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/interface/new-line-error/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":4}}, + "errors": [ + "SyntaxError: Missing semicolon (2:1)" + ], + "program": { + "type": "Program", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":4}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "Identifier", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"interface"}, + "name": "interface" + } + }, + { + "type": "ExpressionStatement", + "start":10,"end":11,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1}}, + "expression": { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"F"}, + "name": "F" + } + }, + { + "type": "BlockStatement", + "start":12,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":4}}, + "body": [], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/module-new-line-error/options.json b/packages/babel-parser/test/fixtures/typescript/module-namespace/module-new-line-error/options.json deleted file mode 100644 index cd6a9c1b1a..0000000000 --- a/packages/babel-parser/test/fixtures/typescript/module-namespace/module-new-line-error/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/module-new-line-error/output.json b/packages/babel-parser/test/fixtures/typescript/module-namespace/module-new-line-error/output.json new file mode 100644 index 0000000000..5c7e547bf6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/module-namespace/module-new-line-error/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, + "errors": [ + "SyntaxError: Missing semicolon (2:3)" + ], + "program": { + "type": "Program", + "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "Identifier", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6},"identifierName":"module"}, + "name": "module" + } + }, + { + "type": "ExpressionStatement", + "start":7,"end":10,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, + "expression": { + "type": "Identifier", + "start":7,"end":10,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3},"identifierName":"Foo"}, + "name": "Foo" + } + }, + { + "type": "BlockStatement", + "start":11,"end":13,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":6}}, + "body": [], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/namespace-new-line-error/options.json b/packages/babel-parser/test/fixtures/typescript/module-namespace/namespace-new-line-error/options.json deleted file mode 100644 index cd6a9c1b1a..0000000000 --- a/packages/babel-parser/test/fixtures/typescript/module-namespace/namespace-new-line-error/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/namespace-new-line-error/output.json b/packages/babel-parser/test/fixtures/typescript/module-namespace/namespace-new-line-error/output.json new file mode 100644 index 0000000000..33ffb7be10 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/module-namespace/namespace-new-line-error/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, + "errors": [ + "SyntaxError: Missing semicolon (2:3)" + ], + "program": { + "type": "Program", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":6}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "Identifier", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9},"identifierName":"namespace"}, + "name": "namespace" + } + }, + { + "type": "ExpressionStatement", + "start":10,"end":13,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}}, + "expression": { + "type": "Identifier", + "start":10,"end":13,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3},"identifierName":"Foo"}, + "name": "Foo" + } + }, + { + "type": "BlockStatement", + "start":14,"end":16,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":6}}, + "body": [], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/intrinsic-keyword-error/options.json b/packages/babel-parser/test/fixtures/typescript/types/intrinsic-keyword-error/options.json deleted file mode 100644 index 640cd6c71b..0000000000 --- a/packages/babel-parser/test/fixtures/typescript/types/intrinsic-keyword-error/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/types/intrinsic-keyword-error/output.json b/packages/babel-parser/test/fixtures/typescript/types/intrinsic-keyword-error/output.json new file mode 100644 index 0000000000..ffd6e5a2a9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/intrinsic-keyword-error/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "errors": [ + "SyntaxError: Missing semicolon (1:20)" + ], + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "id": { + "type": "Identifier", + "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8},"identifierName":"Foo"}, + "name": "Foo" + }, + "typeAnnotation": { + "type": "TSIntrinsicKeyword", + "start":11,"end":20,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":20}} + } + }, + { + "type": "ExpressionStatement", + "start":20,"end":28,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":28}}, + "expression": { + "type": "ArrayExpression", + "start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, + "elements": [ + { + "type": "StringLiteral", + "start":21,"end":26,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":26}}, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/variable-declarator/definite-assignment-not-allowed/options.json b/packages/babel-parser/test/fixtures/typescript/variable-declarator/definite-assignment-not-allowed/options.json index c4c1edaca3..9ce9658f7d 100644 --- a/packages/babel-parser/test/fixtures/typescript/variable-declarator/definite-assignment-not-allowed/options.json +++ b/packages/babel-parser/test/fixtures/typescript/variable-declarator/definite-assignment-not-allowed/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \";\" (1:6)" + "throws": "Unexpected token (1:8)" }