uglify-js
Advanced tools
Comparing version 1.0.7 to 1.1.0
@@ -192,3 +192,3 @@ /*********************************************************************** | ||
var WHITESPACE_CHARS = array_to_hash(characters(" \u00a0\n\r\t\f\u000b\u200b")); | ||
var WHITESPACE_CHARS = array_to_hash(characters(" \u00a0\n\r\t\f\u000b\u200b\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000")); | ||
@@ -261,7 +261,3 @@ var PUNC_BEFORE_EXPRESSION = array_to_hash(characters("[{}(,.;:")); | ||
this.pos = pos; | ||
try { | ||
({})(); | ||
} catch(ex) { | ||
this.stack = ex.stack; | ||
}; | ||
this.stack = new Error().stack; | ||
}; | ||
@@ -513,5 +509,5 @@ | ||
function read_regexp() { | ||
function read_regexp(regexp) { | ||
return with_eof_error("Unterminated regular expression", function(){ | ||
var prev_backslash = false, regexp = "", ch, in_class = false; | ||
var prev_backslash = false, ch, in_class = false; | ||
while ((ch = next(true))) if (prev_backslash) { | ||
@@ -565,3 +561,3 @@ regexp += "\\" + ch; | ||
} | ||
return S.regex_allowed ? read_regexp() : read_operator("/"); | ||
return S.regex_allowed ? read_regexp("") : read_operator("/"); | ||
}; | ||
@@ -597,4 +593,4 @@ | ||
function next_token(force_regexp) { | ||
if (force_regexp) | ||
return read_regexp(); | ||
if (force_regexp != null) | ||
return read_regexp(force_regexp); | ||
skip_whitespace(); | ||
@@ -788,5 +784,5 @@ start_token(); | ||
var statement = maybe_embed_tokens(function() { | ||
if (is("operator", "/")) { | ||
if (is("operator", "/") || is("operator", "/=")) { | ||
S.peeked = null; | ||
S.token = S.input(true); // force regexp | ||
S.token = S.input(S.token.value.substr(1)); // force regexp | ||
} | ||
@@ -861,2 +857,4 @@ switch (S.token.type) { | ||
case "throw": | ||
if (S.token.nlb) | ||
croak("Illegal newline after 'throw'"); | ||
return as("throw", prog1(expression, semicolon)); | ||
@@ -1237,3 +1235,3 @@ | ||
if (!exigent_mode) return true; | ||
switch (expr[0]) { | ||
switch (expr[0]+"") { | ||
case "dot": | ||
@@ -1240,0 +1238,0 @@ case "sub": |
{ | ||
"name" : "uglify-js", | ||
"description" : "JavaScript parser and compressor/beautifier toolkit", | ||
"author" : { | ||
@@ -10,3 +12,3 @@ "name" : "Mihai Bazon", | ||
"version" : "1.0.7", | ||
"version" : "1.1.0", | ||
@@ -13,0 +15,0 @@ "main" : "./uglify-js.js", |
@@ -396,3 +396,4 @@ #! /usr/bin/env node | ||
['l !== "px" && (d.style(h, c, (k || 1) + l), j = (k || 1) / f.cur() * j, d.style(h, c, j + l)), i[1] && (k = (i[1] === "-=" ? -1 : 1) * k + j), f.custom(j, k, l)', 'this choked regex/div at some point'], | ||
['(/\'/g, \'\\\\\\\'\') + "\'";', 'the sequence of escaped characters confused the tokenizer'] | ||
['(/\'/g, \'\\\\\\\'\') + "\'";', 'the sequence of escaped characters confused the tokenizer'], | ||
['if (true) /=a/.test("a");', 'regexp starting with "=" in not obvious context (not implied by preceding token)'] | ||
]; | ||
@@ -399,0 +400,0 @@ |
@@ -14,4 +14,18 @@ #! /usr/bin/env node | ||
var w = pro.ast_walker(); | ||
ast = w.with_walkers({ | ||
"function": function() { | ||
var node = w.dive(this); // walk depth first | ||
console.log(pro.gen_code(node, { beautify: true })); | ||
return node; | ||
}, | ||
"name": function(name) { | ||
return [ this[0], "X" ]; | ||
} | ||
}, function(){ | ||
return w.walk(ast); | ||
}); | ||
console.log(pro.gen_code(ast, { | ||
beautify: true | ||
})); |
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
258811
100
4127
572