aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-11-01 17:01:00 +0000
committerGitHub <noreply@github.com>2020-11-02 01:01:00 +0800
commite7643248a314244caeae8464ae5b713ede5b2e3d (patch)
tree13efca8e3107c70d0ec65aa2d850fbce0556327b /lib/compress.js
parent68091dbf699bc575f73d60fd202c6da3eae4b272 (diff)
downloadtracifyjs-e7643248a314244caeae8464ae5b713ede5b2e3d.tar.gz
tracifyjs-e7643248a314244caeae8464ae5b713ede5b2e3d.zip
fix corner case in `merge_vars` (#4258)
fixes #4257
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 0e8b495f..0c49d49d 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -4502,7 +4502,7 @@ merge(Compressor.prototype, {
segment.loop = true;
var save = segment;
node.body.walk(tw);
- if (segment.loop == "c") segment = save;
+ if (segment.inserted === node) segment = save;
node.condition.walk(tw);
pop();
return true;
@@ -4543,7 +4543,9 @@ merge(Compressor.prototype, {
if (node instanceof AST_LabeledStatement) {
push();
segment.block = node;
+ var save = segment;
node.body.walk(tw);
+ if (segment.inserted === node) segment = save;
pop();
return true;
}
@@ -4580,7 +4582,9 @@ merge(Compressor.prototype, {
node.body.forEach(function(branch) {
push();
segment.block = node;
+ var save = segment;
walk_body(branch, tw);
+ if (segment.inserted === node) segment = save;
pop();
});
return true;
@@ -4746,7 +4750,7 @@ merge(Compressor.prototype, {
stack.push(segment);
pop();
}
- segment.loop = "c";
+ segment.inserted = segment.block;
push();
while (stack.length) {
var seg = stack.pop();