uglify-js
Advanced tools
Comparing version 3.6.3 to 3.6.4
@@ -94,9 +94,7 @@ /*********************************************************************** | ||
}; | ||
} | ||
else if (typeof comments === "function") { | ||
} else if (typeof comments === "function") { | ||
comment_filter = function(comment) { | ||
return comment.type != "comment5" && comments(this, comment); | ||
}; | ||
} | ||
else if (comments === "some") { | ||
} else if (comments === "some") { | ||
comment_filter = is_some_comments; | ||
@@ -456,3 +454,3 @@ } else { // NOTE includes "all" option | ||
var comments = dump(node); | ||
if (!comments) return; | ||
if (!comments) comments = []; | ||
@@ -648,4 +646,3 @@ if (scan) { | ||
active_scope = self; | ||
} | ||
else if (!use_asm && self instanceof AST_Directive && self.value == "use asm") { | ||
} else if (!use_asm && self instanceof AST_Directive && self.value == "use asm") { | ||
use_asm = active_scope; | ||
@@ -1049,7 +1046,5 @@ } | ||
b = b.alternative; | ||
} | ||
else if (b instanceof AST_StatementWithBody) { | ||
} else if (b instanceof AST_StatementWithBody) { | ||
b = b.body; | ||
} | ||
else break; | ||
} else break; | ||
} | ||
@@ -1056,0 +1051,0 @@ force_statement(self.body, output); |
@@ -237,2 +237,3 @@ /*********************************************************************** | ||
}; | ||
var prev_was_dot = false; | ||
@@ -290,12 +291,8 @@ function peek() { | ||
var prev_was_dot = false; | ||
function token(type, value, is_comment) { | ||
S.regex_allowed = ((type == "operator" && !UNARY_POSTFIX[value]) || | ||
(type == "keyword" && KEYWORDS_BEFORE_EXPRESSION[value]) || | ||
(type == "punc" && PUNC_BEFORE_EXPRESSION[value])); | ||
if (type == "punc" && value == ".") { | ||
prev_was_dot = true; | ||
} else if (!is_comment) { | ||
prev_was_dot = false; | ||
} | ||
S.regex_allowed = type == "operator" && !UNARY_POSTFIX[value] | ||
|| type == "keyword" && KEYWORDS_BEFORE_EXPRESSION[value] | ||
|| type == "punc" && PUNC_BEFORE_EXPRESSION[value]; | ||
if (type == "punc" && value == ".") prev_was_dot = true; | ||
else if (!is_comment) prev_was_dot = false; | ||
var ret = { | ||
@@ -363,7 +360,4 @@ type : type, | ||
var valid = parse_js_number(num); | ||
if (!isNaN(valid)) { | ||
return token("num", valid); | ||
} else { | ||
parse_error("Invalid syntax: " + num); | ||
} | ||
if (!isNaN(valid)) return token("num", valid); | ||
parse_error("Invalid syntax: " + num); | ||
} | ||
@@ -469,4 +463,3 @@ | ||
else break; | ||
} | ||
else { | ||
} else { | ||
if (ch != "u") parse_error("Expecting UnicodeEscapeSequence -- uXXXX"); | ||
@@ -545,5 +538,3 @@ ch = read_escaped_char(); | ||
next(); | ||
return is_digit(peek().charCodeAt(0)) | ||
? read_num(".") | ||
: token("punc", "."); | ||
return is_digit(peek().charCodeAt(0)) ? read_num(".") : token("punc", "."); | ||
} | ||
@@ -600,7 +591,6 @@ | ||
case 46: return handle_dot(); | ||
case 47: { | ||
var tok = handle_slash(); | ||
if (tok === next_token) continue; | ||
return tok; | ||
} | ||
case 47: | ||
var tok = handle_slash(); | ||
if (tok === next_token) continue; | ||
return tok; | ||
} | ||
@@ -623,8 +613,4 @@ if (is_digit(code)) return read_num(); | ||
S.directive_stack[S.directive_stack.length - 1].push(directive); | ||
if (S.directives[directive] === undefined) { | ||
S.directives[directive] = 1; | ||
} else { | ||
S.directives[directive]++; | ||
} | ||
if (S.directives[directive]) S.directives[directive]++; | ||
else S.directives[directive] = 1; | ||
} | ||
@@ -637,9 +623,6 @@ | ||
next_token.pop_directives_stack = function() { | ||
var directives = S.directive_stack[S.directive_stack.length - 1]; | ||
for (var i = 0; i < directives.length; i++) { | ||
var directives = S.directive_stack.pop(); | ||
for (var i = directives.length; --i >= 0;) { | ||
S.directives[directives[i]]--; | ||
} | ||
S.directive_stack.pop(); | ||
} | ||
@@ -656,23 +639,13 @@ | ||
var UNARY_PREFIX = makePredicate([ | ||
"typeof", | ||
"void", | ||
"delete", | ||
"--", | ||
"++", | ||
"!", | ||
"~", | ||
"-", | ||
"+" | ||
]); | ||
var UNARY_PREFIX = makePredicate("typeof void delete -- ++ ! ~ - +"); | ||
var UNARY_POSTFIX = makePredicate([ "--", "++" ]); | ||
var UNARY_POSTFIX = makePredicate("-- ++"); | ||
var ASSIGNMENT = makePredicate([ "=", "+=", "-=", "/=", "*=", "%=", ">>=", "<<=", ">>>=", "|=", "^=", "&=" ]); | ||
var ASSIGNMENT = makePredicate("= += -= /= *= %= >>= <<= >>>= |= ^= &="); | ||
var PRECEDENCE = function(a, ret) { | ||
for (var i = 0; i < a.length; ++i) { | ||
var b = a[i]; | ||
for (var j = 0; j < b.length; ++j) { | ||
ret[b[j]] = i + 1; | ||
for (var i = 0; i < a.length;) { | ||
var b = a[i++]; | ||
for (var j = 0; j < b.length; j++) { | ||
ret[b[j]] = i; | ||
} | ||
@@ -694,3 +667,3 @@ } | ||
var ATOMIC_START_TOKEN = makePredicate([ "atom", "num", "string", "regexp", "name" ]); | ||
var ATOMIC_START_TOKEN = makePredicate("atom num string regexp name"); | ||
@@ -711,6 +684,5 @@ /* -----[ Parser ]----- */ | ||
var S = { | ||
input : (typeof $TEXT == "string" | ||
? tokenizer($TEXT, options.filename, | ||
options.html5_comments, options.shebang) | ||
: $TEXT), | ||
input : typeof $TEXT == "string" | ||
? tokenizer($TEXT, options.filename, options.html5_comments, options.shebang) | ||
: $TEXT, | ||
token : null, | ||
@@ -771,4 +743,3 @@ prev : null, | ||
function unexpected(token) { | ||
if (token == null) | ||
token = S.token; | ||
if (token == null) token = S.token; | ||
token_error(token, "Unexpected token: " + token_to_string(token.type, token.value)); | ||
@@ -778,5 +749,3 @@ } | ||
function expect_token(type, val) { | ||
if (is(type, val)) { | ||
return next(); | ||
} | ||
if (is(type, val)) return next(); | ||
token_error(S.token, "Unexpected token: " + token_to_string(S.token.type, S.token.value) + ", expected: " + token_to_string(type, val)); | ||
@@ -783,0 +752,0 @@ } |
@@ -295,5 +295,3 @@ /*********************************************************************** | ||
def.orig.push(symbol); | ||
if (def.init && (def.scope !== symbol.scope || def.init instanceof AST_Function)) { | ||
def.init = init; | ||
} | ||
if (def.init instanceof AST_Function) def.init = init; | ||
} else { | ||
@@ -300,0 +298,0 @@ def = new SymbolDef(this, symbol, init); |
@@ -130,4 +130,3 @@ /*********************************************************************** | ||
} | ||
} | ||
else if (val !== skip) { | ||
} else if (val !== skip) { | ||
if (val instanceof Splice) { | ||
@@ -149,4 +148,3 @@ ret.push.apply(ret, backwards ? val.v.slice().reverse() : val.v); | ||
} | ||
} | ||
else { | ||
} else { | ||
for (i in a) if (HOP(a, i)) if (doit()) break; | ||
@@ -153,0 +151,0 @@ } |
@@ -6,3 +6,3 @@ { | ||
"license": "BSD-2-Clause", | ||
"version": "3.6.3", | ||
"version": "3.6.4", | ||
"engines": { | ||
@@ -9,0 +9,0 @@ "node": ">=0.8.0" |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
754881
19556