fix corner case in collapse_vars (#4733)

fixes #4732
This commit is contained in:
Alex Lam S.L
2021-03-04 09:13:54 +00:00
committed by GitHub
parent 20be5209c0
commit cb50a2d192
2 changed files with 50 additions and 1 deletions

View File

@@ -2675,9 +2675,10 @@ merge(Compressor.prototype, {
if (hit_index <= end) return handle_custom_scan_order(node, tt);
hit = true;
if (node instanceof AST_VarDef) {
node.value = null;
declare_only[node.name.name] = (declare_only[node.name.name] || 0) + 1;
if (value_def) value_def.replaced++;
node = node.clone();
node.value = null;
return node;
}
return in_list ? List.skip : null;