fix corner case with nameCache (#3338)

fixes #3301
This commit is contained in:
Alex Lam S.L
2019-03-15 01:15:50 +08:00
committed by GitHub
parent d90777b724
commit 627f5fb41e
2 changed files with 29 additions and 1 deletions

View File

@@ -309,8 +309,12 @@ function names_in_use(scope, options) {
if (!names) {
scope.names_in_use = names = Object.create(scope.mangled_names || null);
scope.cname_holes = [];
var cache = options.cache && options.cache.props;
scope.enclosed.forEach(function(def) {
if (def.unmangleable(options)) names[def.name] = true;
if (def.global && cache && cache.has(def.name)) {
names[cache.get(def.name)] = true;
}
});
}
return names;