Skip to content

Commit

Permalink
Bump flow-parser from 0.121.0 to 0.122.0 (#7935)
Browse files Browse the repository at this point in the history
* Bump flow-parser from 0.121.0 to 0.122.0

Bumps [flow-parser](https://github.com/facebook/flow) from 0.121.0 to 0.122.0.
- [Release notes](https://github.com/facebook/flow/releases)
- [Changelog](https://github.com/facebook/flow/blob/master/Changelog.md)
- [Commits](facebook/flow@v0.121.0...v0.122.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Remove ForAwaitStatement

* Remove RestProperty

* Add tests for for-await

* Fix snapshots

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>
  • Loading branch information
dependabot-preview[bot] and sosukesuzuki committed Apr 4, 2020
1 parent 877874e commit 46fc3de
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"fast-glob": "3.2.2",
"find-parent-dir": "0.3.0",
"find-project-root": "1.1.1",
"flow-parser": "0.121.0",
"flow-parser": "0.122.0",
"get-stream": "5.1.0",
"globby": "11.0.0",
"graphql": "15.0.0",
Expand Down
1 change: 0 additions & 1 deletion src/language-js/needs-parens.js
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,6 @@ function isStatement(node) {
node.type === "ExportDefaultDeclaration" ||
node.type === "ExportNamedDeclaration" ||
node.type === "ExpressionStatement" ||
node.type === "ForAwaitStatement" ||
node.type === "ForInStatement" ||
node.type === "ForOfStatement" ||
node.type === "ForStatement" ||
Expand Down
17 changes: 3 additions & 14 deletions src/language-js/printer-estree.js
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,6 @@ function printPathNoParens(path, options, print, args) {
return concat(["%", n.name]);
case "SpreadElement":
case "SpreadElementPattern":
case "RestProperty":
case "SpreadProperty":
case "SpreadPropertyPattern":
case "RestElement":
Expand Down Expand Up @@ -1421,9 +1420,7 @@ function printPathNoParens(path, options, print, args) {
const canHaveTrailingSeparator = !(
n.inexact ||
(lastElem &&
(lastElem.type === "RestProperty" ||
lastElem.type === "RestElement" ||
hasNodeIgnoreComment(lastElem)))
(lastElem.type === "RestElement" || hasNodeIgnoreComment(lastElem)))
);

let content;
Expand Down Expand Up @@ -1754,8 +1751,7 @@ function printPathNoParens(path, options, print, args) {
const isParentForLoop =
parentNode.type === "ForStatement" ||
parentNode.type === "ForInStatement" ||
parentNode.type === "ForOfStatement" ||
parentNode.type === "ForAwaitStatement";
parentNode.type === "ForOfStatement";

const hasValue = n.declarations.some((decl) => decl.init);

Expand Down Expand Up @@ -1953,16 +1949,10 @@ function printPathNoParens(path, options, print, args) {
);

case "ForOfStatement":
case "ForAwaitStatement": {
// Babel 7 removed ForAwaitStatement in favor of ForOfStatement
// with `"await": true`:
// https://github.com/estree/estree/pull/138
const isAwait = n.type === "ForAwaitStatement" || n.await;

return group(
concat([
"for",
isAwait ? " await" : "",
n.await ? " await" : "",
" (",
path.call(print, "left"),
" of ",
Expand All @@ -1971,7 +1961,6 @@ function printPathNoParens(path, options, print, args) {
adjustClause(n.body, path.call(print, "body")),
])
);
}

case "DoWhileStatement": {
const clause = adjustClause(n.body, path.call(print, "body"));
Expand Down
47 changes: 47 additions & 0 deletions tests/for_await/__snapshots__/jsfmt.spec.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`for-await.js 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
async function foo() {
for await (num of asyncIterable) {
console.log(num);
}
for await (num of asyncGeneratorFunc()) {
console.log(num);
}
}
(async () => {
for await (num of asyncIterable) {
console.log(num);
}
for await (const x of delegate_yield()) {
x;
}
})();
=====================================output=====================================
async function foo() {
for await (num of asyncIterable) {
console.log(num);
}
for await (num of asyncGeneratorFunc()) {
console.log(num);
}
}
(async () => {
for await (num of asyncIterable) {
console.log(num);
}
for await (const x of delegate_yield()) {
x;
}
})();
================================================================================
`;
17 changes: 17 additions & 0 deletions tests/for_await/for-await.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
async function foo() {
for await (num of asyncIterable) {
console.log(num);
}
for await (num of asyncGeneratorFunc()) {
console.log(num);
}
}

(async () => {
for await (num of asyncIterable) {
console.log(num);
}
for await (const x of delegate_yield()) {
x;
}
})();
1 change: 1 addition & 0 deletions tests/for_await/jsfmt.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
run_spec(__dirname, ["babel", "flow", "typescript"]);
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3547,10 +3547,10 @@ flatten@^1.0.2:
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.3.tgz#c1283ac9f27b368abc1e36d1ff7b04501a30356b"
integrity sha512-dVsPA/UwQ8+2uoFe5GHtiBMu48dWLTdsuEd7CKGlZlD78r1TTWBvDuFaFGKCo/ZfEr95Uk56vZoX86OsHkUeIg==

flow-parser@0.121.0:
version "0.121.0"
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.121.0.tgz#9f9898eaec91a9f7c323e9e992d81ab5c58e618f"
integrity sha512-1gIBiWJNR0tKUNv8gZuk7l9rVX06OuLzY9AoGio7y/JT4V1IZErEMEq2TJS+PFcw/y0RshZ1J/27VfK1UQzYVg==
flow-parser@0.122.0:
version "0.122.0"
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.122.0.tgz#f8258ba4200b2bec66c18ce00a323e3330e42b1a"
integrity sha512-rb4pLIb7JAWn4dnO+fB9YLTUOM0SvY1ZN2yeu2NOyL7f2JeXBp9Nevqf+h4OluQcdI+9CnGa/if/HUy1YOX0dA==

flush-write-stream@^1.0.0:
version "1.1.1"
Expand Down

0 comments on commit 46fc3de

Please sign in to comment.