diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-03-05 17:11:05 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-06 01:11:05 +0800 |
commit | 2db1a141ab16911cf10de885a619be7b2b97b28b (patch) | |
tree | a6643ea9d00b07e5b245302a418bf487607b3fab /test/reduce.js | |
parent | dd30ed6a9bf108f05b103eef81d84f91ae4c6322 (diff) | |
download | tracifyjs-2db1a141ab16911cf10de885a619be7b2b97b28b.tar.gz tracifyjs-2db1a141ab16911cf10de885a619be7b2b97b28b.zip |
speed up `compress` tests (#4737)
Diffstat (limited to 'test/reduce.js')
-rw-r--r-- | test/reduce.js | 13 |
1 files changed, 6 insertions, 7 deletions
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++; |