@@ -5743,7 +5743,10 @@ merge(Compressor.prototype, {
|
|||||||
if (prop.key instanceof AST_Node) prop.key.walk(tw);
|
if (prop.key instanceof AST_Node) prop.key.walk(tw);
|
||||||
if (!prop.value) return;
|
if (!prop.value) return;
|
||||||
if (is_export || prop instanceof AST_ClassField && prop.static) {
|
if (is_export || prop instanceof AST_ClassField && prop.static) {
|
||||||
|
var save_scope = scope;
|
||||||
|
scope = node;
|
||||||
prop.value.walk(tw);
|
prop.value.walk(tw);
|
||||||
|
scope = save_scope;
|
||||||
} else {
|
} else {
|
||||||
initializations.add(def.id, prop.value);
|
initializations.add(def.id, prop.value);
|
||||||
}
|
}
|
||||||
@@ -5793,6 +5796,12 @@ merge(Compressor.prototype, {
|
|||||||
assignments.add(def.id, node);
|
assignments.add(def.id, node);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} else if (node instanceof AST_This && scope instanceof AST_DefClass) {
|
||||||
|
var def = scope.name.definition();
|
||||||
|
if (!(def.id in in_use_ids)) {
|
||||||
|
in_use_ids[def.id] = true;
|
||||||
|
in_use.push(def);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return scan_ref_scoped(node, descend, true);
|
return scan_ref_scoped(node, descend, true);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -572,3 +572,27 @@ computed_key_generator: {
|
|||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
node_version: ">=4"
|
node_version: ">=4"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_4681: {
|
||||||
|
options = {
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
console.log(function(a) {
|
||||||
|
class A {
|
||||||
|
static p = a = this;
|
||||||
|
}
|
||||||
|
return typeof a;
|
||||||
|
}());
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
console.log(function(a) {
|
||||||
|
class A {
|
||||||
|
static p = a = this;
|
||||||
|
}
|
||||||
|
return typeof a;
|
||||||
|
}());
|
||||||
|
}
|
||||||
|
expect_stdout: "function"
|
||||||
|
node_version: ">=12"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user