Add parens for ConditionalExpression inside JSXSpreadAttribute (#1015)
parent
c82bb4e003
commit
b8a7e5166b
|
@ -440,6 +440,7 @@ FPp.needsParens = function(assumeExpressionContext) {
|
|||
case "LogicalExpression":
|
||||
case "ExportDefaultDeclaration":
|
||||
case "AwaitExpression":
|
||||
case "JSXSpreadAttribute":
|
||||
return true;
|
||||
|
||||
case "NewExpression":
|
||||
|
|
|
@ -551,6 +551,8 @@ exports[`parens.js 1`] = `
|
|||
d='M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,'
|
||||
/>,
|
||||
];
|
||||
|
||||
<div {...((foo || foo === null) ? {foo} : null)} />
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
a = [
|
||||
<path
|
||||
|
@ -562,6 +564,8 @@ a = [
|
|||
d=\\"M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,\\"
|
||||
/>
|
||||
];
|
||||
|
||||
<div {...foo || foo === null ? { foo } : null} />;
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -576,6 +580,8 @@ exports[`parens.js 2`] = `
|
|||
d='M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,'
|
||||
/>,
|
||||
];
|
||||
|
||||
<div {...((foo || foo === null) ? {foo} : null)} />
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
a = [
|
||||
<path
|
||||
|
@ -587,6 +593,8 @@ a = [
|
|||
d=\\"M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,\\"
|
||||
/>
|
||||
];
|
||||
|
||||
<div {...foo || foo === null ? { foo } : null} />;
|
||||
"
|
||||
`;
|
||||
|
||||
|
|
|
@ -8,3 +8,5 @@ a = [
|
|||
d='M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,M13.6,10.6l,4-2.8L9.5,'
|
||||
/>,
|
||||
];
|
||||
|
||||
<div {...((foo || foo === null) ? {foo} : null)} />
|
||||
|
|
Loading…
Reference in New Issue