fix corner case in inline & reduce_vars (#5579)

This commit is contained in:
Alex Lam S.L
2022-07-28 16:53:11 +01:00
committed by GitHub
parent db6fd6db3e
commit 513995f57d
4 changed files with 58 additions and 8 deletions

View File

@@ -286,7 +286,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
// ensure mangling works if `catch` reuses a scope variable
var redef = def.redefined();
if (redef) for (var s = node.scope; s; s = s.parent_scope) {
push_uniq(s.enclosed, redef);
if (!push_uniq(s.enclosed, redef)) break;
if (s === redef.scope) break;
}
} else if (node instanceof AST_SymbolConst) {
@@ -480,7 +480,7 @@ AST_Lambda.DEFMETHOD("init_vars", function(parent_scope) {
AST_Symbol.DEFMETHOD("mark_enclosed", function(options) {
var def = this.definition();
for (var s = this.scope; s; s = s.parent_scope) {
push_uniq(s.enclosed, def);
if (!push_uniq(s.enclosed, def)) break;
if (!options) {
s._var_names = undefined;
} else {