@@ -4750,6 +4750,8 @@ merge(Compressor.prototype, {
|
|||||||
var ldef = node.variables.get(ref.name);
|
var ldef = node.variables.get(ref.name);
|
||||||
if (ldef && (ldef === def || def.undeclared || node.parent_scope.find_variable(ref) === def)) {
|
if (ldef && (ldef === def || def.undeclared || node.parent_scope.find_variable(ref) === def)) {
|
||||||
references[ldef.id] = false;
|
references[ldef.id] = false;
|
||||||
|
} else {
|
||||||
|
mark(ref, true, false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1470,3 +1470,35 @@ issue_4288: {
|
|||||||
expect_stdout: "undefined"
|
expect_stdout: "undefined"
|
||||||
node_version: ">=6"
|
node_version: ">=6"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_4294: {
|
||||||
|
options = {
|
||||||
|
merge_vars: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
A = "PASS";
|
||||||
|
(function() {
|
||||||
|
var a = function({
|
||||||
|
[a]: {},
|
||||||
|
}) {}({
|
||||||
|
[a]: 0,
|
||||||
|
});
|
||||||
|
var b = A;
|
||||||
|
console.log(b);
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
A = "PASS";
|
||||||
|
(function() {
|
||||||
|
var a = function({
|
||||||
|
[a]: {},
|
||||||
|
}) {}({
|
||||||
|
[a]: 0,
|
||||||
|
});
|
||||||
|
var b = A;
|
||||||
|
console.log(b);
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=6"
|
||||||
|
}
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ module.exports = function reduce_test(testcase, minify_options, reduce_options)
|
|||||||
|
|
||||||
// ignore lvalues
|
// ignore lvalues
|
||||||
if (parent instanceof U.AST_Assign && parent.left === node) return;
|
if (parent instanceof U.AST_Assign && parent.left === node) return;
|
||||||
if (parent instanceof U.AST_Destructured) return;
|
if (parent instanceof U.AST_DestructuredArray) return;
|
||||||
if (parent instanceof U.AST_DestructuredKeyVal && parent.value === node) return;
|
if (parent instanceof U.AST_DestructuredKeyVal && parent.value === node) return;
|
||||||
if (parent instanceof U.AST_Unary && parent.expression === node) switch (parent.operator) {
|
if (parent instanceof U.AST_Unary && parent.expression === node) switch (parent.operator) {
|
||||||
case "++":
|
case "++":
|
||||||
|
|||||||
Reference in New Issue
Block a user