fix corner case in side_effects (#3984)

fixes #3983
This commit is contained in:
Alex Lam S.L
2020-06-10 12:30:37 +01:00
committed by GitHub
parent 2a9d0fc6fb
commit 1dbf7d4a3a
2 changed files with 33 additions and 3 deletions

View File

@@ -5279,7 +5279,8 @@ merge(Compressor.prototype, {
});
def(AST_SymbolRef, function(compressor) {
if (!this.is_declared(compressor)) return this;
this.definition().replaced++;
var def = this.definition();
if (member(this, def.references)) def.replaced++;
return null;
});
def(AST_This, return_null);
@@ -7575,9 +7576,8 @@ merge(Compressor.prototype, {
function recursive_ref(compressor, def) {
var level = 0, node = compressor.self();
do {
if (node instanceof AST_Lambda && node.name && node.name.definition() === def) break;
if (node instanceof AST_Lambda && node.name && node.name.definition() === def) return node;
} while (node = compressor.parent(level++));
return node;
}
OPT(AST_SymbolRef, function(self, compressor) {