fix corner case in collapse_vars (#4332)

fixes #4331
This commit is contained in:
Alex Lam S.L
2020-12-06 10:30:50 +00:00
committed by GitHub
parent 37f4f56752
commit 3c384cf9a8
2 changed files with 27 additions and 0 deletions

View File

@@ -2047,6 +2047,7 @@ merge(Compressor.prototype, {
return (parent.tail_node() === node ? find_stop_value : find_stop_unused)(parent, level + 1);
}
if (parent instanceof AST_SimpleStatement) return find_stop_unused(parent, level + 1);
if (parent instanceof AST_Spread) return find_stop_value(parent, level + 1);
if (parent instanceof AST_Switch) {
if (parent.expression !== node) return node;
return find_stop_value(parent, level + 1);