Always retain lines for async arrow (#11836)
This commit is contained in:
parent
7eaf37ea3e
commit
e12caf4f69
@ -112,7 +112,7 @@ export function ArrowFunctionExpression(node: Object) {
|
|||||||
!hasTypes(node, firstParam)
|
!hasTypes(node, firstParam)
|
||||||
) {
|
) {
|
||||||
if (
|
if (
|
||||||
this.format.retainLines &&
|
(this.format.retainLines || node.async) &&
|
||||||
node.loc &&
|
node.loc &&
|
||||||
node.body.loc &&
|
node.body.loc &&
|
||||||
node.loc.start.line < node.body.loc.start.line
|
node.loc.start.line < node.body.loc.start.line
|
||||||
|
|||||||
10
packages/babel-generator/test/fixtures/parentheses/async-arrow-function/input.js
vendored
Normal file
10
packages/babel-generator/test/fixtures/parentheses/async-arrow-function/input.js
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
const x = async (
|
||||||
|
// some comment
|
||||||
|
a
|
||||||
|
) => {
|
||||||
|
return foo(await a);
|
||||||
|
};
|
||||||
|
|
||||||
|
function foo(a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
1
packages/babel-generator/test/fixtures/parentheses/async-arrow-function/options.json
vendored
Normal file
1
packages/babel-generator/test/fixtures/parentheses/async-arrow-function/options.json
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
8
packages/babel-generator/test/fixtures/parentheses/async-arrow-function/output.js
vendored
Normal file
8
packages/babel-generator/test/fixtures/parentheses/async-arrow-function/output.js
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
const x = async ( // some comment
|
||||||
|
a) => {
|
||||||
|
return foo(await a);
|
||||||
|
};
|
||||||
|
|
||||||
|
function foo(a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user