Socket
Socket
Sign inDemoInstall

uglify-js

Package Overview
Dependencies
Maintainers
3
Versions
288
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uglify-js - npm Package Compare versions

Comparing version 2.2.1 to 2.2.2

test/compress/issue-59.js

2

lib/ast.js

@@ -290,5 +290,5 @@ /***********************************************************************

var self = this;
var to_export = [];
if (export_all) {
self.figure_out_scope();
var to_export = [];
self.walk(new TreeWalker(function(node){

@@ -295,0 +295,0 @@ if (node instanceof AST_SymbolDeclaration && node.definition().global) {

@@ -343,6 +343,6 @@ /***********************************************************************

function DEFPRINT(nodetype, generator) {
nodetype.DEFMETHOD("print", function(stream){
nodetype.DEFMETHOD("print", function(stream, force_parens){
var self = this;
stream.push_node(self);
if (self.needs_parens(stream)) {
if (force_parens || self.needs_parens(stream)) {
stream.with_parens(function(){

@@ -471,14 +471,2 @@ self.add_comments(stream);

}
// for (var i = (foo in bar);;); ← perhaps useless, but valid syntax
if (this.operator == "in") {
// the “NoIn” stuff :-\
// UglifyJS 1.3.3 misses this one.
if ((p instanceof AST_For || p instanceof AST_ForIn) && p.init === this)
return true;
if (p instanceof AST_VarDef) {
var v = output.parent(1), p2 = output.parent(2);
if ((p2 instanceof AST_For || p2 instanceof AST_ForIn) && p2.init === v)
return true;
}
}
});

@@ -627,3 +615,7 @@

if (self.init) {
self.init.print(output);
if (self.init instanceof AST_Definitions) {
self.init.print(output);
} else {
parenthesize_for_noin(self.init, output, true);
}
output.print(";");

@@ -872,2 +864,19 @@ output.space();

});
function parenthesize_for_noin(node, output, noin) {
if (!noin) node.print(output);
else try {
// need to take some precautions here:
// https://github.com/mishoo/UglifyJS2/issues/60
node.walk(new TreeWalker(function(node){
if (node instanceof AST_Binary && node.operator == "in")
throw output;
}));
node.print(output);
} catch(ex) {
if (ex !== output) throw ex;
node.print(output, true);
}
};
DEFPRINT(AST_VarDef, function(self, output){

@@ -879,3 +888,5 @@ self.name.print(output);

output.space();
self.value.print(output);
var p = output.parent(1);
var noin = p instanceof AST_For || p instanceof AST_ForIn;
parenthesize_for_noin(self.value, output, noin);
}

@@ -882,0 +893,0 @@ });

@@ -113,5 +113,2 @@ /***********************************************************************

}
if (node instanceof AST_SymbolDeclaration) {
node.init_scope_vars();
}
if (node instanceof AST_Symbol) {

@@ -132,4 +129,2 @@ node.scope = scope;

(node.scope = scope.parent_scope).def_function(node);
node.init.push(tw.parent());
}

@@ -143,3 +138,2 @@ else if (node instanceof AST_SymbolDefun) {

(node.scope = scope.parent_scope).def_function(node);
node.init.push(tw.parent());
}

@@ -151,3 +145,2 @@ else if (node instanceof AST_SymbolVar

def = tw.parent();
if (def.value) node.init.push(def);
}

@@ -253,6 +246,2 @@ else if (node instanceof AST_SymbolCatch) {

AST_SymbolDeclaration.DEFMETHOD("init_scope_vars", function(){
this.init = [];
});
AST_Label.DEFMETHOD("init_scope_vars", function(){

@@ -259,0 +248,0 @@ this.references = [];

@@ -258,2 +258,10 @@ /***********************************************************************

},
add: function(key, val) {
if (this.has(key)) {
this.get(key).push(val);
} else {
this.set(key, [ val ]);
}
return this;
},
get: function(key) { return this._values["$" + key] },

@@ -260,0 +268,0 @@ del: function(key) {

@@ -6,3 +6,3 @@ {

"main": "tools/node.js",
"version": "2.2.1",
"version": "2.2.2",
"engines": { "node" : ">=0.4.0" },

@@ -9,0 +9,0 @@ "maintainers": [{

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc