@@ -938,7 +938,8 @@ merge(Compressor.prototype, {
|
|||||||
node.variables.each(function(def) {
|
node.variables.each(function(def) {
|
||||||
reset_def(tw, compressor, def);
|
reset_def(tw, compressor, def);
|
||||||
});
|
});
|
||||||
if (!node.name) return;
|
if (node.extends) node.extends.walk(tw);
|
||||||
|
if (node.name) {
|
||||||
var d = node.name.definition();
|
var d = node.name.definition();
|
||||||
var parent = tw.parent();
|
var parent = tw.parent();
|
||||||
if (parent instanceof AST_ExportDeclaration || parent instanceof AST_ExportDefault) d.single_use = false;
|
if (parent instanceof AST_ExportDeclaration || parent instanceof AST_ExportDefault) d.single_use = false;
|
||||||
@@ -953,16 +954,19 @@ merge(Compressor.prototype, {
|
|||||||
} else {
|
} else {
|
||||||
d.fixed = false;
|
d.fixed = false;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
def(AST_ClassField, function(tw) {
|
node.properties.filter(function(prop) {
|
||||||
var node = this;
|
if (prop.key instanceof AST_Node) prop.key.walk(tw);
|
||||||
if (node.static) return;
|
return prop.value;
|
||||||
if (node.key instanceof AST_Node) node.key.walk(tw);
|
}).forEach(function(prop) {
|
||||||
if (node.value) {
|
if (prop.static) {
|
||||||
|
prop.value.walk(tw);
|
||||||
|
} else {
|
||||||
push(tw);
|
push(tw);
|
||||||
node.value.walk(tw);
|
prop.value.walk(tw);
|
||||||
pop(tw);
|
pop(tw);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
def(AST_Conditional, function(tw) {
|
def(AST_Conditional, function(tw) {
|
||||||
|
|||||||
@@ -747,3 +747,24 @@ issue_4687_2: {
|
|||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
node_version: ">=4"
|
node_version: ">=4"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_4705: {
|
||||||
|
options = {
|
||||||
|
evaluate: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var a = "PASS";
|
||||||
|
class A {
|
||||||
|
p = a = "FAIL";
|
||||||
|
[console.log(a)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
console.log("PASS");
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=12"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user