Fix extra parens for update expressions (#796)
* Remove parens around UpdateExpression when parent is CallExpression. * Add new test case.master
parent
7c4654b7a3
commit
c8c1875fc8
|
@ -258,7 +258,6 @@ FPp.needsParens = function(assumeExpressionContext) {
|
||||||
return name === "object" && parent.object === node;
|
return name === "object" && parent.object === node;
|
||||||
|
|
||||||
case "TaggedTemplateExpression":
|
case "TaggedTemplateExpression":
|
||||||
case "CallExpression":
|
|
||||||
case "NewExpression":
|
case "NewExpression":
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,11 @@ exports[`update_expression.js 1`] = `
|
||||||
"(this.x++).toString()
|
"(this.x++).toString()
|
||||||
new (r++);
|
new (r++);
|
||||||
(x++)();
|
(x++)();
|
||||||
|
const uuid = String(this._uuidCounter++);
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
(this.x++).toString();
|
(this.x++).toString();
|
||||||
new (r++)();
|
new (r++)();
|
||||||
(x++)();
|
(x++)();
|
||||||
|
const uuid = String(this._uuidCounter++);
|
||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
(this.x++).toString()
|
(this.x++).toString()
|
||||||
new (r++);
|
new (r++);
|
||||||
(x++)();
|
(x++)();
|
||||||
|
const uuid = String(this._uuidCounter++);
|
||||||
|
|
Loading…
Reference in New Issue