@@ -6797,7 +6797,8 @@ merge(Compressor.prototype, {
|
|||||||
var def = self.definition();
|
var def = self.definition();
|
||||||
var fixed = self.fixed_value();
|
var fixed = self.fixed_value();
|
||||||
var single_use = def.single_use && !(parent instanceof AST_Call && parent.is_expr_pure(compressor));
|
var single_use = def.single_use && !(parent instanceof AST_Call && parent.is_expr_pure(compressor));
|
||||||
if (single_use && fixed instanceof AST_Lambda) {
|
if (single_use) {
|
||||||
|
if (fixed instanceof AST_Lambda) {
|
||||||
if (def.scope !== self.scope
|
if (def.scope !== self.scope
|
||||||
&& (!compressor.option("reduce_funcs") || def.escaped.depth == 1 || fixed.inlined)) {
|
&& (!compressor.option("reduce_funcs") || def.escaped.depth == 1 || fixed.inlined)) {
|
||||||
single_use = false;
|
single_use = false;
|
||||||
@@ -6813,8 +6814,11 @@ merge(Compressor.prototype, {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (single_use) fixed.parent_scope = self.scope;
|
if (single_use) fixed.parent_scope = self.scope;
|
||||||
|
} else if (!fixed || !fixed.is_constant_expression()) {
|
||||||
|
single_use = false;
|
||||||
}
|
}
|
||||||
if (single_use && fixed) {
|
}
|
||||||
|
if (single_use) {
|
||||||
def.single_use = false;
|
def.single_use = false;
|
||||||
fixed._squeezed = true;
|
fixed._squeezed = true;
|
||||||
fixed.single_use = true;
|
fixed.single_use = true;
|
||||||
|
|||||||
@@ -6847,3 +6847,34 @@ issue_3631_2: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "undefined"
|
expect_stdout: "undefined"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_3666: {
|
||||||
|
options = {
|
||||||
|
collapse_vars: true,
|
||||||
|
passes: 2,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
try {
|
||||||
|
var a = "FAIL";
|
||||||
|
} finally {
|
||||||
|
for (;!a;)
|
||||||
|
var c = a++;
|
||||||
|
var a = "PASS", b = c = "PASS";
|
||||||
|
}
|
||||||
|
console.log(a, b);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
try {
|
||||||
|
var a = "FAIL";
|
||||||
|
} finally {
|
||||||
|
for (;!a;)
|
||||||
|
a++;
|
||||||
|
var b = a = "PASS";
|
||||||
|
}
|
||||||
|
console.log(a, b);
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS PASS"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user