@@ -455,7 +455,7 @@ merge(Compressor.prototype, {
|
|||||||
if (def.fixed == null) {
|
if (def.fixed == null) {
|
||||||
if (is_arguments(def)) return false;
|
if (is_arguments(def)) return false;
|
||||||
if (def.global && def.name == "arguments") return false;
|
if (def.global && def.name == "arguments") return false;
|
||||||
def.fixed = make_node(AST_Undefined, def.orig);
|
def.fixed = make_node(AST_Undefined, def.orig[0]);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -3870,7 +3870,7 @@ merge(Compressor.prototype, {
|
|||||||
def.value = null;
|
def.value = null;
|
||||||
head.push(def);
|
head.push(def);
|
||||||
} else {
|
} else {
|
||||||
var value = def.value && def.value.drop_side_effect_free(compressor);
|
var value = def.value && !def.value.single_use && def.value.drop_side_effect_free(compressor);
|
||||||
if (value) {
|
if (value) {
|
||||||
AST_Node.warn("Side effects in initialization of unused variable {name} [{file}:{line},{col}]", template(def.name));
|
AST_Node.warn("Side effects in initialization of unused variable {name} [{file}:{line},{col}]", template(def.name));
|
||||||
side_effects.push(value);
|
side_effects.push(value);
|
||||||
|
|||||||
@@ -2235,3 +2235,34 @@ function_assign: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_3598: {
|
||||||
|
options = {
|
||||||
|
collapse_vars: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var a = "FAIL";
|
||||||
|
try {
|
||||||
|
(function() {
|
||||||
|
var b = void 0;
|
||||||
|
a = "PASS";
|
||||||
|
c.p = 0;
|
||||||
|
var c = b[!1];
|
||||||
|
})();
|
||||||
|
} catch (e) {}
|
||||||
|
console.log(a);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var a = "FAIL";
|
||||||
|
try {
|
||||||
|
(function() {
|
||||||
|
a = "PASS";
|
||||||
|
var c = (void (c.p = 0))[!1];
|
||||||
|
})();
|
||||||
|
} catch (e) {}
|
||||||
|
console.log(a);
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user