Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Recover from "missing semicolon" errors (#12437)
* Recover from "missing semicolon" errors * Update other tests * Fix flow * Fix windows test * Add back deleted test
- Loading branch information
1 parent
2ea0a5d
commit 8cf0a75
Showing
127 changed files
with
2,077 additions
and
164 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
packages/babel-cli/test/fixtures/babel/stdin --filename windows/stderr.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
SyntaxError: <CWD>\test.js: Unexpected token, expected ";" (2:10) | ||
SyntaxError: <CWD>\test.js: Missing semicolon (2:10) |
2 changes: 1 addition & 1 deletion
2
packages/babel-cli/test/fixtures/babel/stdin --filename/stderr.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
SyntaxError: <CWD>/test.js: Unexpected token, expected ";" (2:10) | ||
SyntaxError: <CWD>/test.js: Missing semicolon (2:10) |
2 changes: 1 addition & 1 deletion
2
packages/babel-core/test/fixtures/transformation/errors/syntax/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"throws": "Unexpected token, expected \";\" (2:10)" | ||
"throws": "Missing semicolon (2:10)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
packages/babel-parser/test/fixtures/core/categorized/for-missing-semicolons/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
for ( | ||
var a = 1 | ||
a < 3 | ||
a++ | ||
) { | ||
|
||
} |
82 changes: 82 additions & 0 deletions
82
packages/babel-parser/test/fixtures/core/categorized/for-missing-semicolons/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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": [] | ||
} | ||
} |
3 changes: 0 additions & 3 deletions
3
packages/babel-parser/test/fixtures/core/regression/octal-float-fail/options.json
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
packages/babel-parser/test/fixtures/core/regression/octal-float-fail/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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": [] | ||
} | ||
} |
3 changes: 0 additions & 3 deletions
3
packages/babel-parser/test/fixtures/core/uncategorised/388/options.json
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
packages/babel-parser/test/fixtures/core/uncategorised/388/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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": [] | ||
} | ||
} |
3 changes: 0 additions & 3 deletions
3
packages/babel-parser/test/fixtures/core/uncategorised/389/options.json
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
packages/babel-parser/test/fixtures/core/uncategorised/389/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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": [] | ||
} | ||
} |
3 changes: 0 additions & 3 deletions
3
packages/babel-parser/test/fixtures/core/uncategorised/405/options.json
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
packages/babel-parser/test/fixtures/core/uncategorised/405/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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": [] | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
packages/babel-parser/test/fixtures/core/uncategorised/407/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"throws": "Unexpected token, expected \";\" (1:2)" | ||
} | ||
"throws": "Unexpected token, expected \"(\" (1:4)" | ||
} |
4 changes: 2 additions & 2 deletions
4
packages/babel-parser/test/fixtures/core/uncategorised/408/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"throws": "Unexpected token, expected \";\" (1:2)" | ||
} | ||
"throws": "A class name is required (1:7)" | ||
} |
4 changes: 2 additions & 2 deletions
4
packages/babel-parser/test/fixtures/core/uncategorised/415/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"throws": "Unexpected token, expected \";\" (1:15)" | ||
} | ||
"throws": "Unexpected token (1:15)" | ||
} |
4 changes: 2 additions & 2 deletions
4
packages/babel-parser/test/fixtures/core/uncategorised/416/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"throws": "Unexpected token, expected \";\" (1:14)" | ||
} | ||
"throws": "Unexpected token (1:14)" | ||
} |
4 changes: 2 additions & 2 deletions
4
packages/babel-parser/test/fixtures/es2015/arrow-functions/no-binary-left/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"throws": "Unexpected token, expected \";\" (1:9)" | ||
} | ||
"throws": "Unexpected token (1:9)" | ||
} |
4 changes: 2 additions & 2 deletions
4
packages/babel-parser/test/fixtures/es2015/arrow-functions/no-callee/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"throws": "Unexpected token, expected \";\" (1:8)" | ||
} | ||
"throws": "Unexpected token (1:9)" | ||
} |
4 changes: 2 additions & 2 deletions
4
packages/babel-parser/test/fixtures/es2015/arrow-functions/no-ternary-test/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"throws": "Unexpected token, expected \";\" (1:9)" | ||
} | ||
"throws": "Unexpected token (1:9)" | ||
} |
3 changes: 0 additions & 3 deletions
3
packages/babel-parser/test/fixtures/es2015/for-of/invalid-escape-of/options.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.