Fix parenthesis for UpdateExpression (#198)

```js
(this.x++).toString()
```

no longer drops the parenthesis
master
Christopher Chedeau 2017-01-14 20:37:57 -08:00 committed by James Long
parent f70c9ec6d1
commit fe72aecce9
4 changed files with 9 additions and 0 deletions

View File

@ -228,6 +228,7 @@ FPp.needsParens = function(assumeExpressionContext) {
}
switch (node.type) {
case "UpdateExpression":
case "UnaryExpression":
case "SpreadElement":
case "SpreadProperty":

View File

@ -0,0 +1,6 @@
exports[`test update_expression.js 1`] = `
"(this.x++).toString()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(this.x++).toString();
"
`;

View File

@ -0,0 +1 @@
run_spec(__dirname);

View File

@ -0,0 +1 @@
(this.x++).toString()