diff options
-rw-r--r-- | lib/compress.js | 1 | ||||
-rw-r--r-- | test/compress/collapse_vars.js | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/compress.js b/lib/compress.js index ce61ce9f..14e83617 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -2399,6 +2399,7 @@ merge(Compressor.prototype, { return this.expression.may_throw(compressor); }); def(AST_VarDef, function(compressor){ + if (!this.value) return false; return this.value.may_throw(compressor); }); })(function(node, func){ diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index 2136b2f0..330667dd 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -3785,3 +3785,23 @@ issue_2571_2: { } expect_stdout: "undefined" } + +may_throw: { + options = { + collapse_vars: true, + } + input: { + function f() { + var a_2 = function() { + var a; + }(); + } + } + expect: { + function f() { + var a_2 = function() { + var a; + }(); + } + } +} |