Update dependencies
This commit is contained in:
parent
7bf6747ebd
commit
8308faa51d
1325 changed files with 2986 additions and 8266 deletions
57
node_modules/uglify-js/lib/ast.js
generated
vendored
57
node_modules/uglify-js/lib/ast.js
generated
vendored
|
@ -2085,33 +2085,40 @@ TreeWalker.prototype = {
|
|||
}
|
||||
},
|
||||
in_boolean_context: function() {
|
||||
var self = this.self();
|
||||
for (var i = 0, p; p = this.parent(i); i++) {
|
||||
if (p instanceof AST_Conditional && p.condition === self
|
||||
|| p instanceof AST_DWLoop && p.condition === self
|
||||
|| p instanceof AST_For && p.condition === self
|
||||
|| p instanceof AST_If && p.condition === self
|
||||
|| p instanceof AST_Return && p.in_bool
|
||||
|| p instanceof AST_Sequence && p.tail_node() !== self
|
||||
|| p instanceof AST_SimpleStatement
|
||||
|| p instanceof AST_UnaryPrefix && p.operator == "!" && p.expression === self) {
|
||||
return true;
|
||||
}
|
||||
if (p instanceof AST_Binary && (p.operator == "&&" || p.operator == "||")
|
||||
|| p instanceof AST_Conditional
|
||||
|| p.tail_node() === self) {
|
||||
self = p;
|
||||
} else if (p instanceof AST_Return) {
|
||||
for (var call, fn = p; call = this.parent(++i); fn = call) {
|
||||
if (call.TYPE == "Call") {
|
||||
if (!(fn instanceof AST_Lambda) || fn.name) return false;
|
||||
} else if (fn instanceof AST_Lambda) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (var drop = true, level = 0, parent, self = this.self(); parent = this.parent(level++); self = parent) {
|
||||
if (parent instanceof AST_Binary) switch (parent.operator) {
|
||||
case "&&":
|
||||
case "||":
|
||||
if (parent.left === self) drop = false;
|
||||
continue;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
if (parent instanceof AST_Conditional) {
|
||||
if (parent.condition === self) return true;
|
||||
continue;
|
||||
}
|
||||
if (parent instanceof AST_DWLoop) return parent.condition === self;
|
||||
if (parent instanceof AST_For) return parent.condition === self;
|
||||
if (parent instanceof AST_If) return parent.condition === self;
|
||||
if (parent instanceof AST_Return) {
|
||||
if (parent.in_bool) return true;
|
||||
while (parent = this.parent(level++)) {
|
||||
if (parent instanceof AST_Lambda) {
|
||||
if (parent.name) return false;
|
||||
parent = this.parent(level++);
|
||||
if (parent.TYPE != "Call") return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (parent instanceof AST_Sequence) {
|
||||
if (parent.tail_node() === self) continue;
|
||||
return drop ? "d" : true;
|
||||
}
|
||||
if (parent instanceof AST_SimpleStatement) return drop ? "d" : true;
|
||||
if (parent instanceof AST_UnaryPrefix) return parent.operator == "!";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue