fix corner case in `--reduce-test` (#4625)
authorAlex Lam S.L <alexlamsl@gmail.com>
Mon, 8 Feb 2021 11:16:21 +0000 (11:16 +0000)
committerGitHub <noreply@github.com>
Mon, 8 Feb 2021 11:16:21 +0000 (19:16 +0800)
test/reduce.js

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