aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/compress.js2
-rw-r--r--test/compress/collapse_vars.js35
2 files changed, 36 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 21eec7c3..911cf554 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -1866,7 +1866,7 @@ merge(Compressor.prototype, {
return null;
}
default:
- return;
+ return handle_custom_scan_order(node, multi_replacer);
}
}
// Replace variable when found
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index eaff0127..fcc47391 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -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"
+}