Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build(deps): Bump @babel/parser from 7.11.2 to 7.11.5 #8947

Merged
merged 11 commits into from Sep 1, 2020
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -22,7 +22,7 @@
"dependencies": {
"@angular/compiler": "10.0.14",
"@babel/code-frame": "7.10.4",
"@babel/parser": "7.11.2",
"@babel/parser": "7.11.5",
"@glimmer/syntax": "0.60.0",
"@iarna/toml": "2.2.5",
"@typescript-eslint/typescript-estree": "3.10.1",
Expand Down
8 changes: 5 additions & 3 deletions src/language-js/printer-estree.js
Expand Up @@ -3682,15 +3682,17 @@ function printMethod(path, options, print) {
if (value.async) {
parts.push("async ");
}
if (value.generator) {
parts.push("*");
}
} else {
assert.ok(kind === "get" || kind === "set");

parts.push(kind, " ");
}

// A `getter`/`setter` can't be a generator, but it's recoverable
if (value.generator) {
parts.push("*");
}

parts.push(
printPropertyKey(path, options, print),
node.optional || node.key.optional ? "?" : "",
Expand Down
32 changes: 31 additions & 1 deletion tests/js/objects/__snapshots__/jsfmt.spec.js.snap
Expand Up @@ -113,6 +113,36 @@ const a3 = {
================================================================================
`;

exports[`invalid-accessor-generator.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
// Invalid, but recoverable
// https://github.com/babel/babel/pull/11921/

({
get *iterator() { },
set *iterator(iter) { },
get iterator2() { },
set iterator2(iter) { },
});

=====================================output=====================================
// Invalid, but recoverable
// https://github.com/babel/babel/pull/11921/

({
get *iterator() {},
set *iterator(iter) {},
get iterator2() {},
set iterator2(iter) {},
});

================================================================================
`;

exports[`method.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
Expand Down Expand Up @@ -165,7 +195,7 @@ group(
================================================================================
`;

exports[`right_break.js format 1`] = `
exports[`right-break.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
Expand Down
9 changes: 9 additions & 0 deletions tests/js/objects/invalid-accessor-generator.js
@@ -0,0 +1,9 @@
// Invalid, but recoverable
// https://github.com/babel/babel/pull/11921/

({
get *iterator() { },
set *iterator(iter) { },
get iterator2() { },
set iterator2(iter) { },
});
File renamed without changes.
7 changes: 7 additions & 0 deletions tests/misc/errors/flow/__snapshots__/jsfmt.spec.js.snap
@@ -1,5 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`async-arrow-invalid.js error test 1`] = `
"Unexpected token ILLEGAL (2:1)
1 | <T> async () => {}
> 2 |
| ^"
`;

exports[`default-escaped.js error test 1`] = `
"Unexpected identifier, expected the token \`{\` (1:8)
> 1 | export asyn\\\\u{63} from \\"async\\";
Expand Down
1 change: 1 addition & 0 deletions tests/misc/errors/flow/async-arrow-invalid.js
@@ -0,0 +1 @@
<T> async () => {}
9 changes: 9 additions & 0 deletions tests/misc/errors/js/__snapshots__/jsfmt.spec.js.snap
Expand Up @@ -18,6 +18,15 @@ exports[`module-attributes.js error test 1`] = `
2 | "
`;

exports[`no-for-in-init-concise-binary-in.js error test 1`] = `
"Unexpected token, expected \\")\\" (3:18)
1 | // https://github.com/babel/babel/pull/11931
2 |
> 3 | for (() => x in y;;);
| ^
4 | "
`;

exports[`partial-template-strings.js error test 1`] = `
"Unexpected token (6:42)
4 |
Expand Down
3 changes: 3 additions & 0 deletions tests/misc/errors/js/no-for-in-init-concise-binary-in.js
@@ -0,0 +1,3 @@
// https://github.com/babel/babel/pull/11931

for (() => x in y;;);
14 changes: 14 additions & 0 deletions tests/misc/flow-babel-only/__snapshots__/jsfmt.spec.js.snap
@@ -1,5 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`async-arrow-invalid.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
<T> async () => {}

=====================================output=====================================
async <T>() => {};

Copy link
Member

@fisker fisker Sep 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should throw on this.

I need #9075 to throw this error.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.... The @babel/parser/lib/parser/error-message is gone...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is expected. The published parser should be a single rollup-ed artifact. If they were published before, they are accidentally included due to incorrect publish process.

================================================================================
`;

exports[`class_with_generics.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
Expand Down
1 change: 1 addition & 0 deletions tests/misc/flow-babel-only/async-arrow-invalid.js
@@ -0,0 +1 @@
<T> async () => {}
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -279,10 +279,10 @@
chalk "^2.0.0"
js-tokens "^4.0.0"

"@babel/parser@7.11.2":
version "7.11.2"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.11.2.tgz#0882ab8a455df3065ea2dcb4c753b2460a24bead"
integrity sha512-Vuj/+7vLo6l1Vi7uuO+1ngCDNeVmNbTngcJFKCR/oEtz8tKz0CJxZEGmPt9KcIloZhOZ3Zit6xbpXT2MDlS9Vw==
"@babel/parser@7.11.5":
version "7.11.5"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.11.5.tgz#c7ff6303df71080ec7a4f5b8c003c58f1cf51037"
integrity sha512-X9rD8qqm695vgmeaQ4fvz/o3+Wk4ZzQvSHkDBgpYKxpD4qTAUm88ZKtHkVqIOsYFFbIQ6wQYhC6q7pjqVK0E0Q==

"@babel/parser@^7.1.0", "@babel/parser@^7.10.4", "@babel/parser@^7.11.0", "@babel/parser@^7.11.4":
version "7.11.4"
Expand Down