@@ -649,7 +649,7 @@ Compressor.prototype.compress = function(node) {
|
||||
}
|
||||
if (!HOP(tw.safe_ids, def.id)) {
|
||||
if (!safe) return false;
|
||||
if (safe.read) {
|
||||
if (safe.read || tw.in_loop) {
|
||||
var scope = tw.find_parent(AST_BlockScope);
|
||||
if (scope instanceof AST_Class) return false;
|
||||
if (def.scope.resolve() !== scope.resolve()) return false;
|
||||
|
||||
@@ -7861,3 +7861,38 @@ issue_5324: {
|
||||
}
|
||||
expect_stdout: "NaN"
|
||||
}
|
||||
|
||||
issue_5434: {
|
||||
options = {
|
||||
evaluate: true,
|
||||
reduce_vars: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
console.log(function(a) {
|
||||
for (var i = 0; i < 2; i++) {
|
||||
var b = "FAIL";
|
||||
f && f();
|
||||
a = b;
|
||||
var f = function() {
|
||||
b = "PASS";
|
||||
};
|
||||
}
|
||||
return a;
|
||||
}());
|
||||
}
|
||||
expect: {
|
||||
console.log(function(a) {
|
||||
for (var i = 0; i < 2; i++) {
|
||||
var b = "FAIL";
|
||||
f && f();
|
||||
a = b;
|
||||
var f = function() {
|
||||
b = "PASS";
|
||||
};
|
||||
}
|
||||
return a;
|
||||
}());
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user