fix corner case in --reduce-test

This commit is contained in:
alexlamsl 2021-02-08 17:17:06 +08:00
parent fd4caf7a9c
commit 1ba14eb274

View File

@ -131,6 +131,7 @@ module.exports = function reduce_test(testcase, minify_options, reduce_options)
case "delete": case "delete":
return; return;
} }
if (parent instanceof U.AST_VarDef && parent.name === node) return;
// preserve for (var xxx; ...) // preserve for (var xxx; ...)
if (parent instanceof U.AST_For && parent.init === node && node instanceof U.AST_Definitions) return node; if (parent instanceof U.AST_For && parent.init === node && node instanceof U.AST_Definitions) return node;
// preserve for (xxx in ...) // preserve for (xxx in ...)