fix corner case in merge_vars (#4170)

fixes #4168
This commit is contained in:
Alex Lam S.L
2020-10-03 00:03:39 +01:00
committed by GitHub
parent baf4903aa7
commit 8cb509d50e
2 changed files with 87 additions and 1 deletions

View File

@@ -4406,7 +4406,12 @@ merge(Compressor.prototype, {
push();
segment.block = node;
if (node === self) root = segment;
if (node instanceof AST_Lambda && node.name) references[node.name.definition().id] = false;
if (node instanceof AST_Lambda) {
if (node.name) references[node.name.definition().id] = false;
if (node.uses_arguments && !tw.has_directive("use strict")) node.argnames.forEach(function(node) {
references[node.definition().id] = false;
});
}
descend();
pop();
return true;
@@ -4474,6 +4479,7 @@ merge(Compressor.prototype, {
return true;
}
});
tw.directives = Object.create(compressor.directives);
self.walk(tw);
var merged = Object.create(null);
while (first.length && last.length) {