Skip to content

Commit

Permalink
fix corner case in collapse_vars (#4853)
Browse files Browse the repository at this point in the history
fixes #4852
  • Loading branch information
alexlamsl committed Apr 8, 2021
1 parent 8a82822 commit ca49f6f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/compress.js
Expand Up @@ -1866,7 +1866,7 @@ merge(Compressor.prototype, {
return null;
}
default:
return;
return handle_custom_scan_order(node, multi_replacer);
}
}
// Replace variable when found
Expand Down
35 changes: 35 additions & 0 deletions test/compress/collapse_vars.js
Expand Up @@ -8897,3 +8897,38 @@ issue_4806: {
}
expect_stdout: "PASS"
}

issue_4852: {
options = {
collapse_vars: true,
}
input: {
var a = "PASS";
(function(b) {
switch (b = a) {
case 42:
try {
console;
} catch (b) {
b.p;
}
case console.log(b):
}
})("FAIL");
}
expect: {
var a = "PASS";
(function(b) {
switch (a) {
case 42:
try {
console;
} catch (b) {
b.p;
}
case console.log(a):
}
})("FAIL");
}
expect_stdout: "PASS"
}

0 comments on commit ca49f6f

Please sign in to comment.