diff options
-rw-r--r-- | lib/compress.js | 2 | ||||
-rw-r--r-- | test/compress/collapse_vars.js | 31 |
2 files changed, 32 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js index e6a064dd..5d14963f 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -1395,7 +1395,7 @@ merge(Compressor.prototype, { var rhs_fn = scan_rhs; for (var i = 0; !abort && i < fn.body.length; i++) { var stat = fn.body[i]; - if (stat instanceof AST_Exit) { + if (stat instanceof AST_Return) { if (stat.value) stat.value.transform(scanner); break; } diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index f109e93e..58ae5c62 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -7734,3 +7734,34 @@ issue_3698_3: { } expect_stdout: "2" } + +issue_3700: { + options = { + collapse_vars: true, + } + input: { + var a = "FAIL"; + try { + a = "PASS"; + (function() { + throw 0; + })(); + a = 1 + a; + } catch (e) { + } + console.log(a); + } + expect: { + var a = "FAIL"; + try { + a = "PASS"; + (function() { + throw 0; + })(); + a = 1 + a; + } catch (e) { + } + console.log(a); + } + expect_stdout: "PASS" +} |