uglify-js
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -257,5 +257,5 @@ /*********************************************************************** | ||
this.message = message; | ||
this.line = line; | ||
this.col = col; | ||
this.pos = pos; | ||
this.line = line + 1; | ||
this.col = col + 1; | ||
this.pos = pos + 1; | ||
this.stack = new Error().stack; | ||
@@ -330,8 +330,9 @@ }; | ||
var ret = { | ||
type : type, | ||
value : value, | ||
line : S.tokline, | ||
col : S.tokcol, | ||
pos : S.tokpos, | ||
nlb : S.newline_before | ||
type : type, | ||
value : value, | ||
line : S.tokline, | ||
col : S.tokcol, | ||
pos : S.tokpos, | ||
endpos : S.pos, | ||
nlb : S.newline_before | ||
}; | ||
@@ -473,4 +474,3 @@ if (!is_comment) { | ||
var i = find("*/", true), | ||
text = S.text.substring(S.pos, i), | ||
tok = token("comment2", text, true); | ||
text = S.text.substring(S.pos, i); | ||
S.pos = i + 2; | ||
@@ -487,3 +487,3 @@ S.line += text.split("\n").length - 1; | ||
return tok; | ||
return token("comment2", text, true); | ||
}); | ||
@@ -939,3 +939,3 @@ }; | ||
var function_ = maybe_embed_tokens(function(in_statement) { | ||
var function_ = function(in_statement) { | ||
var name = is("name") ? prog1(S.token.value, next) : null; | ||
@@ -968,3 +968,3 @@ if (in_statement && !name) | ||
})()); | ||
}); | ||
}; | ||
@@ -1317,3 +1317,3 @@ function if_() { | ||
for (var i = array.length; --i >= 0;) | ||
if (array[i] === name) | ||
if (array[i] == name) | ||
return true; | ||
@@ -1320,0 +1320,0 @@ return false; |
@@ -29,7 +29,17 @@ var jsp = require("./parse-js"), | ||
"new": function(ctor, args) { | ||
if (ctor[0] == "name" && ctor[1] == "Array" && !scope.has("Array")) { | ||
if (args.length != 1) { | ||
return [ "array", args ]; | ||
} else { | ||
return walk([ "call", [ "name", "Array" ], args ]); | ||
if (ctor[0] == "name") { | ||
if (ctor[1] == "Array" && !scope.has("Array")) { | ||
if (args.length != 1) { | ||
return [ "array", args ]; | ||
} else { | ||
return walk([ "call", [ "name", "Array" ], args ]); | ||
} | ||
} else if (ctor[1] == "Object" && !scope.has("Object")) { | ||
if (!args.length) { | ||
return [ "object", [] ]; | ||
} else { | ||
return walk([ "call", [ "name", "Object" ], args ]); | ||
} | ||
} else if ((ctor[1] == "RegExp" || ctor[1] == "Function" || ctor[1] == "Error") && !scope.has(ctor[1])) { | ||
return walk([ "call", [ "name", ctor[1] ], args]); | ||
} | ||
@@ -43,4 +53,12 @@ } | ||
} | ||
if (expr[0] == "name" && expr[1] == "Array" && args.length != 1 && !scope.has("Array")) { | ||
return [ "array", args ]; | ||
if (expr[0] == "name") { | ||
if (expr[1] == "Array" && args.length != 1 && !scope.has("Array")) { | ||
return [ "array", args ]; | ||
} | ||
if (expr[1] == "Object" && !args.length && !scope.has("Object")) { | ||
return [ "object", [] ]; | ||
} | ||
if (expr[1] == "String" && !scope.has("String")) { | ||
return [ "binary", "+", args[0], [ "string", "" ]]; | ||
} | ||
} | ||
@@ -47,0 +65,0 @@ } |
@@ -12,3 +12,3 @@ { | ||
"version" : "1.1.1", | ||
"version" : "1.2.0", | ||
@@ -15,0 +15,0 @@ "main" : "./uglify-js.js", |
@@ -1,1 +0,1 @@ | ||
a:1 | ||
1 |
@@ -1,1 +0,1 @@ | ||
label1:{label2:break label2;console.log(1)} | ||
a:break a;console.log(1) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
262546
102
4165
575
0
6