uglify-js
Advanced tools
Comparing version 2.2.4 to 2.2.5
@@ -378,2 +378,12 @@ /*********************************************************************** | ||
var comments = start.comments_before; | ||
// XXX: ugly fix for https://github.com/mishoo/UglifyJS2/issues/112 | ||
// if this node is `return` or `throw`, we cannot allow comments before | ||
// the returned or thrown value. | ||
if (self instanceof AST_Exit && | ||
self.value && self.value.start.comments_before.length > 0) { | ||
comments = (comments || []).concat(self.value.start.comments_before); | ||
self.value.start.comments_before = []; | ||
} | ||
if (c.test) { | ||
@@ -503,3 +513,3 @@ comments = comments.filter(function(comment){ | ||
if (no_constructor_parens(this, output) | ||
&& (p instanceof AST_Dot // (new Date).getTime() | ||
&& (p instanceof AST_PropAccess // (new Date).getTime(), (new Date)["getTime"]() | ||
|| p instanceof AST_Call && p.expression === this)) // (new foo)(bar) | ||
@@ -509,2 +519,14 @@ return true; | ||
PARENS(AST_Number, function(output){ | ||
var p = output.parent(); | ||
if (this.getValue() < 0 && p instanceof AST_PropAccess && p.expression === this) | ||
return true; | ||
}); | ||
PARENS(AST_NaN, function(output){ | ||
var p = output.parent(); | ||
if (p instanceof AST_PropAccess && p.expression === this) | ||
return true; | ||
}); | ||
function assign_and_conditional_paren_rules(output) { | ||
@@ -938,3 +960,3 @@ var p = output.parent(); | ||
expr.print(output); | ||
if (expr instanceof AST_Number) { | ||
if (expr instanceof AST_Number && expr.getValue() >= 0) { | ||
if (!/[xa-f.]/i.test(output.last())) { | ||
@@ -1066,2 +1088,5 @@ output.print("."); | ||
output.print(str); | ||
var p = output.parent(); | ||
if (p instanceof AST_Binary && /^in/.test(p.operator) && p.left === self) | ||
output.print(" "); | ||
}); | ||
@@ -1068,0 +1093,0 @@ |
@@ -144,3 +144,3 @@ /*********************************************************************** | ||
def.constant = node instanceof AST_SymbolConst; | ||
def = tw.parent(); | ||
def.init = tw.parent().value; | ||
} | ||
@@ -147,0 +147,0 @@ else if (node instanceof AST_SymbolCatch) { |
@@ -6,3 +6,3 @@ { | ||
"main": "tools/node.js", | ||
"version": "2.2.4", | ||
"version": "2.2.5", | ||
"engines": { "node" : ">=0.4.0" }, | ||
@@ -9,0 +9,0 @@ "maintainers": [{ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
323367
7871