@@ -9522,11 +9522,9 @@ merge(Compressor.prototype, {
|
||||
refs.forEach(function(ref) {
|
||||
ref.scope = exp === fn ? fn.parent_scope : exp.scope;
|
||||
ref.reference();
|
||||
if (replacing) {
|
||||
ref.definition().replaced++;
|
||||
} else {
|
||||
ref.definition().single_use = false;
|
||||
}
|
||||
var def = ref.definition();
|
||||
if (replacing) def.replaced++;
|
||||
def.single_use = false;
|
||||
});
|
||||
return node;
|
||||
} else if (!node.has_side_effects(compressor)) {
|
||||
|
||||
@@ -2008,3 +2008,61 @@ issue_5053_4: {
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=4"
|
||||
}
|
||||
|
||||
issue_5082_1: {
|
||||
options = {
|
||||
inline: true,
|
||||
reduce_vars: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
(function() {
|
||||
class A {
|
||||
p = console.log("PASS");
|
||||
q() {}
|
||||
}
|
||||
class B {
|
||||
static P = new A();
|
||||
}
|
||||
})();
|
||||
}
|
||||
expect: {
|
||||
(function() {
|
||||
class A {
|
||||
p = console.log("PASS");
|
||||
q() {}
|
||||
}
|
||||
new A();
|
||||
})();
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=12"
|
||||
}
|
||||
|
||||
issue_5082_2: {
|
||||
options = {
|
||||
inline: true,
|
||||
passes: 2,
|
||||
reduce_vars: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
(function() {
|
||||
class A {
|
||||
p = console.log("PASS");
|
||||
q() {}
|
||||
}
|
||||
class B {
|
||||
static P = new A();
|
||||
}
|
||||
})();
|
||||
}
|
||||
expect: {
|
||||
void new class {
|
||||
p = console.log("PASS");
|
||||
q() {}
|
||||
}();
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=12"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user