@@ -5182,7 +5182,7 @@ merge(Compressor.prototype, {
|
|||||||
var def = sym.definition();
|
var def = sym.definition();
|
||||||
if (!def) return;
|
if (!def) return;
|
||||||
if (def.id in in_use_ids) return;
|
if (def.id in in_use_ids) return;
|
||||||
if (def.scope !== self && member(def, self.enclosed)) return;
|
if (def.scope !== self && self.find_variable(sym) === def) return;
|
||||||
log(sym, "Dropping unused loop variable {name}");
|
log(sym, "Dropping unused loop variable {name}");
|
||||||
if (for_ins[def.id] === node) delete for_ins[def.id];
|
if (for_ins[def.id] === node) delete for_ins[def.id];
|
||||||
var body = [];
|
var body = [];
|
||||||
|
|||||||
@@ -1222,3 +1222,35 @@ do_continue: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_4240: {
|
||||||
|
options = {
|
||||||
|
loops: true,
|
||||||
|
reduce_funcs: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
(function(a) {
|
||||||
|
function f() {
|
||||||
|
var o = { PASS: 42 };
|
||||||
|
for (a in o);
|
||||||
|
}
|
||||||
|
(function() {
|
||||||
|
if (f());
|
||||||
|
})();
|
||||||
|
console.log(a);
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
(function(a) {
|
||||||
|
(function() {
|
||||||
|
if (function() {
|
||||||
|
for (a in { PASS: 42 });
|
||||||
|
}());
|
||||||
|
})();
|
||||||
|
console.log(a);
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user