[Pkg-javascript-commits] [uglifyjs] 13/28: Actually, even better. #475

Jonas Smedegaard dr at jones.dk
Thu Oct 16 11:57:30 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository uglifyjs.

commit 7bf59b5bcd4fb477ce7ea60aaa29ea89b865a955
Author: Mihai Bazon <mihai at bazon.net>
Date:   Sun Apr 27 21:42:14 2014 +0300

    Actually, even better.  #475
    
    - also handle x = + ++y, x = - --y;
    - don't use parens, a space suffices.
---
 lib/output.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/output.js b/lib/output.js
index 26f230a..b963792 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){

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git



More information about the Pkg-javascript-commits mailing list