aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-09-16 23:35:22 +0100
committerGitHub <noreply@github.com>2020-09-17 06:35:22 +0800
commitfdf2e8c5b079e3977b766c271d61a10cc3ab9947 (patch)
tree6103611c78a975bc756a4ce33bcbdbe6bcd780de /lib/compress.js
parenta9d934ab4eacc3c987a91f8e7fd176e983c36f55 (diff)
downloadtracifyjs-fdf2e8c5b079e3977b766c271d61a10cc3ab9947.tar.gz
tracifyjs-fdf2e8c5b079e3977b766c271d61a10cc3ab9947.zip
enhance `collapse_vars` (#4117)
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js
index f19832e1..89d698da 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -1458,9 +1458,15 @@ merge(Compressor.prototype, {
}
function handle_custom_scan_order(node, tt) {
+ // Scan object only in a for-in statement
+ if (node instanceof AST_ForIn) {
+ node.object = node.object.transform(tt);
+ abort = true;
+ return node;
+ }
// Skip (non-executed) functions
if (node instanceof AST_Scope) return node;
- // Scan case expressions first in a switch statement
+ // Scan first case expression only in a switch statement
if (node instanceof AST_Switch) {
node.expression = node.expression.transform(tt);
for (var i = 0; !abort && i < node.body.length; i++) {
@@ -1493,7 +1499,7 @@ merge(Compressor.prototype, {
}
if (node instanceof AST_Debugger) return true;
if (node instanceof AST_Defun) return funarg && lhs.name === node.name.name;
- if (node instanceof AST_IterationStatement) return !(node instanceof AST_For);
+ if (node instanceof AST_DWLoop) return true;
if (node instanceof AST_LoopControl) return true;
if (node instanceof AST_Try) return true;
if (node instanceof AST_With) return true;