diff --git a/lib/output.js b/lib/output.js index 26f230af..b9637929 100644 --- a/lib/output.js +++ b/lib/output.js @@ -455,8 +455,7 @@ function OutputStream(options) { PARENS(AST_Unary, function(output){ var p = output.parent(); - return (p instanceof AST_PropAccess && p.expression === this) - || (p instanceof AST_Unary && p.operator == this.operator); + return p instanceof AST_PropAccess && p.expression === this; }); PARENS(AST_Seq, function(output){ @@ -997,8 +996,12 @@ function OutputStream(options) { DEFPRINT(AST_UnaryPrefix, function(self, output){ var op = self.operator; output.print(op); - if (/^[a-z]/i.test(op)) + if (/^[a-z]/i.test(op) + || (/[+-]$/.test(op) + && self.expression instanceof AST_UnaryPrefix + && /^[+-]/.test(self.expression.operator))) { output.space(); + } self.expression.print(output); }); DEFPRINT(AST_UnaryPostfix, function(self, output){