speed up compress tests (#4737)

This commit is contained in:
Alex Lam S.L
2021-03-05 17:11:05 +00:00
committed by GitHub
parent dd30ed6a9b
commit 2db1a141ab
2 changed files with 22 additions and 18 deletions

View File

@@ -137,6 +137,12 @@ module.exports = function reduce_test(testcase, minify_options, reduce_options)
if (parent instanceof U.AST_ExportDefault) return;
if (parent instanceof U.AST_ExportForeign) return;
if (parent instanceof U.AST_ExportReferences) return;
// preserve sole definition of an export statement
if (node instanceof U.AST_VarDef
&& parent.definitions.length == 1
&& tt.parent(1) instanceof U.AST_ExportDeclaration) {
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/of ...)
@@ -460,13 +466,6 @@ module.exports = function reduce_test(testcase, minify_options, reduce_options)
return List.skip;
}
// preserve sole definition of an export statement
if (node instanceof U.AST_VarDef
&& parent.definitions.length == 1
&& tt.parent(1) instanceof U.AST_ExportDeclaration) {
return node;
}
// remove this node unless its the sole element of a (transient) sequence
if (!(parent instanceof U.AST_Sequence) || parent.expressions.length > 1) {
node.start._permute++;