Merge pull request #3380 from babel/unary-arrow
Fix: Add parens for unary arrow function
This commit is contained in:
commit
1271d2cd52
@ -203,6 +203,10 @@ export function ArrowFunctionExpression(node, parent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (t.isUnaryExpression(parent)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return UnaryLike(node, parent);
|
||||
}
|
||||
|
||||
|
||||
3
packages/babel-generator/test/fixtures/parentheses/unary-arrow-function/actual.js
vendored
Normal file
3
packages/babel-generator/test/fixtures/parentheses/unary-arrow-function/actual.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
void (() => {});
|
||||
typeof (() => {});
|
||||
!(() => {});
|
||||
3
packages/babel-generator/test/fixtures/parentheses/unary-arrow-function/expected.js
vendored
Normal file
3
packages/babel-generator/test/fixtures/parentheses/unary-arrow-function/expected.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
void (() => {});
|
||||
typeof (() => {});
|
||||
!(() => {});
|
||||
Loading…
x
Reference in New Issue
Block a user