fix corner case in inline & reduce_vars (#5579)
This commit is contained in:
@@ -8387,9 +8387,8 @@ Compressor.prototype.compress = function(node) {
|
||||
var scopes = [ this ];
|
||||
if (orig instanceof AST_SymbolDeclaration) orig.definition().references.forEach(function(ref) {
|
||||
var s = ref.scope;
|
||||
if (member(s, scopes)) return;
|
||||
do {
|
||||
push_uniq(scopes, s);
|
||||
if (!push_uniq(scopes, s)) return;
|
||||
s = s.parent_scope;
|
||||
} while (s && s !== this);
|
||||
});
|
||||
@@ -12251,12 +12250,19 @@ Compressor.prototype.compress = function(node) {
|
||||
if (fixed instanceof AST_DefClass) fixed = to_class_expr(fixed);
|
||||
if (fixed instanceof AST_LambdaDefinition) fixed = to_func_expr(fixed);
|
||||
if (is_lambda(fixed)) {
|
||||
var scope = self.scope.resolve();
|
||||
var scopes = [];
|
||||
var scope = self.scope;
|
||||
do {
|
||||
scopes.push(scope);
|
||||
if (scope === def.scope) break;
|
||||
} while (scope = scope.parent_scope);
|
||||
fixed.enclosed.forEach(function(def) {
|
||||
if (fixed.variables.has(def.name)) return;
|
||||
if (scope.var_names().has(def.name)) return;
|
||||
scope.enclosed.push(def);
|
||||
scope.var_names().set(def.name, true);
|
||||
for (var i = 0; i < scopes.length; i++) {
|
||||
var scope = scopes[i];
|
||||
if (!push_uniq(scope.enclosed, def)) return;
|
||||
scope.var_names().set(def.name, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
var value;
|
||||
|
||||
Reference in New Issue
Block a user