Remove for-each-in syntax (#9585)

This commit is contained in:
fisker Cheung authored and GitHub committed 2020-11-04 08:52:49 +08:00
1 parent c7390d33b7
commit bbd1f5d1d5
3 files changed
+54 -2

No files matched your search

+1 -2
View File
@@ -1716,10 +1716,9 @@ function printPathNoParens(path, options, print, args) {
])
);
case "ForInStatement":
// Note: esprima can't actually parse "for each (".
return group(
concat([
n.each ? "for each (" : "for (",
"for (",
path.call(print, "left"),
" in ",
path.call(print, "right"),
@@ -0,0 +1,37 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`snippet: #0 error test 1`] = `
"Unexpected token, expected \\"(\\" (1:5)
> 1 | for each (a in b) {}
| ^"
`;
exports[`snippet: #0 error test 2`] = `
"Unexpected identifier, expected the token \`(\` (1:5)
> 1 | for each (a in b) {}
| ^^^^"
`;
exports[`snippet: #0 error test 3`] = `
"'(' expected. (1:5)
> 1 | for each (a in b) {}
| ^"
`;
exports[`snippet: #0 error test 4`] = `
"Unexpected token, expected \\"(\\" (1:5)
> 1 | for each (a in b) {}
| ^"
`;
exports[`snippet: #0 error test 5`] = `
"Unexpected token, expected \\"(\\" (1:5)
> 1 | for each (a in b) {}
| ^"
`;
exports[`snippet: #0 error test 6`] = `
"Unexpected token each (1:5)
> 1 | for each (a in b) {}
| ^"
`;
+16
View File
@@ -0,0 +1,16 @@
for (const parser of [
"babel",
"flow",
"typescript",
"babel-flow",
"babel-ts",
"espree",
]) {
run_spec(
{
dirname: __dirname,
snippets: ["for each (a in b) {}"],
},
[parser]
);
}