@@ -10446,9 +10446,8 @@ Compressor.prototype.compress = function(node) {
|
|||||||
append_var(decl_var, expr_var, name, value);
|
append_var(decl_var, expr_var, name, value);
|
||||||
if (!in_loop) continue;
|
if (!in_loop) continue;
|
||||||
if (arg_used.has(name.name)) continue;
|
if (arg_used.has(name.name)) continue;
|
||||||
var def = fn.variables.get(name.name);
|
var def = name.definition();
|
||||||
if (fn.functions.has(name.name) && def.orig.length == 1) continue;
|
if (def.orig.length == 1 && fn.functions.has(name.name)) continue;
|
||||||
var def = fn.variables.get(name.name);
|
|
||||||
var sym = make_node(AST_SymbolRef, name, name);
|
var sym = make_node(AST_SymbolRef, name, name);
|
||||||
def.references.push(sym);
|
def.references.push(sym);
|
||||||
expr_loop.push(make_node(AST_Assign, var_def, {
|
expr_loop.push(make_node(AST_Assign, var_def, {
|
||||||
@@ -13094,8 +13093,8 @@ Compressor.prototype.compress = function(node) {
|
|||||||
scope.variables.set(name, def);
|
scope.variables.set(name, def);
|
||||||
def.single_use = false;
|
def.single_use = false;
|
||||||
if (!in_loop) return;
|
if (!in_loop) return;
|
||||||
if (fn.functions.has(name) && def.orig.length == 1) return;
|
|
||||||
if (def.references.length == def.replaced) return;
|
if (def.references.length == def.replaced) return;
|
||||||
|
if (def.orig.length == 1 && fn.functions.has(name)) return;
|
||||||
if (!all(def.orig, function(sym) {
|
if (!all(def.orig, function(sym) {
|
||||||
if (sym instanceof AST_SymbolConst) return false;
|
if (sym instanceof AST_SymbolConst) return false;
|
||||||
if (sym instanceof AST_SymbolFunarg) return def.scope.resolve() !== fn;
|
if (sym instanceof AST_SymbolFunarg) return def.scope.resolve() !== fn;
|
||||||
|
|||||||
@@ -3367,3 +3367,28 @@ issue_5189_2: {
|
|||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
node_version: ">=6"
|
node_version: ">=6"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_5288: {
|
||||||
|
options = {
|
||||||
|
conditionals: true,
|
||||||
|
inline: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
varify: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
while (function([]) {}([ function f() {
|
||||||
|
if (console)
|
||||||
|
return console.log("PASS");
|
||||||
|
else {
|
||||||
|
let a = 0;
|
||||||
|
}
|
||||||
|
}() ]));
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
while ([ [ console ? console.log("PASS") : 0 ] ], void 0);
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=6"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user