From 2db1a141ab16911cf10de885a619be7b2b97b28b Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Fri, 5 Mar 2021 17:11:05 +0000 Subject: speed up `compress` tests (#4737) --- test/reduce.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'test/reduce.js') diff --git a/test/reduce.js b/test/reduce.js index b7f5c030..6f413789 100644 --- a/test/reduce.js +++ b/test/reduce.js @@ -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++; -- cgit v1.2.3