From b9f72a4a81d69a7dd782a5ee70f7eee1cb4aa0e0 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sun, 11 Mar 2018 15:54:43 +0800 Subject: handle `case` correctly under `reduce_vars` (#2993) fixes #2992 --- lib/compress.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'lib/compress.js') diff --git a/lib/compress.js b/lib/compress.js index 2f109a17..1b52f83e 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -517,6 +517,15 @@ merge(Compressor.prototype, { pop(tw); return true; }); + def(AST_Case, function(tw) { + push(tw); + this.expression.walk(tw); + pop(tw); + push(tw); + walk_body(this, tw); + pop(tw); + return true; + }); def(AST_Conditional, function(tw) { this.condition.walk(tw); push(tw); @@ -527,6 +536,12 @@ merge(Compressor.prototype, { pop(tw); return true; }); + def(AST_Default, function(tw, descend) { + push(tw); + descend(); + pop(tw); + return true; + }); def(AST_Defun, function(tw, descend, compressor) { this.inlined = false; var save_ids = tw.safe_ids; @@ -624,12 +639,6 @@ merge(Compressor.prototype, { pop(tw); return true; }); - def(AST_SwitchBranch, function(tw, descend) { - push(tw); - descend(); - pop(tw); - return true; - }); def(AST_SymbolCatch, function() { this.definition().fixed = false; }); -- cgit v1.2.3