aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-12-16 20:47:48 +0000
committerGitHub <noreply@github.com>2020-12-17 04:47:48 +0800
commitf68e267830c94f129df4c9e93674abfafbc0125b (patch)
treebac0fbdd864b40346222a1e0634ab879832f6824 /lib
parent8b10b93ee1cd583aa15f608a89a51353a1828944 (diff)
downloadtracifyjs-f68e267830c94f129df4c9e93674abfafbc0125b.tar.gz
tracifyjs-f68e267830c94f129df4c9e93674abfafbc0125b.zip
fix corner case in `reduce_vars` (#4384)
fixes #4383
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/compress.js b/lib/compress.js
index fb5bcb74..b767264c 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -644,7 +644,14 @@ merge(Compressor.prototype, {
fixed = save;
return true;
}
- visit(node, fixed);
+ visit(node, fixed, function() {
+ var save_len = tw.stack.length;
+ for (var i = 0, len = scanner.stack.length - 1; i < len; i++) {
+ tw.stack.push(scanner.stack[i]);
+ }
+ node.walk(tw);
+ tw.stack.length = save_len;
+ });
return true;
});
lhs.walk(scanner);
@@ -678,10 +685,10 @@ merge(Compressor.prototype, {
node.right.walk(tw);
scan_declaration(tw, left, function() {
return node.right;
- }, function(sym, fixed) {
+ }, function(sym, fixed, walk) {
if (!(sym instanceof AST_SymbolRef)) {
mark_assignment_to_arguments(sym);
- sym.walk(tw);
+ walk();
return;
}
var d = sym.definition();
@@ -696,7 +703,7 @@ merge(Compressor.prototype, {
sym.fixed = d.fixed = fixed;
sym.fixed.assigns = [ node ];
} else {
- sym.walk(tw);
+ walk();
d.fixed = false;
}
});