diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-12-16 15:21:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-16 15:21:09 +0800 |
commit | 21794c9b8d0102ed00a15d1e54314908c92e4a24 (patch) | |
tree | 7ca474873acaaa9303c2521b069f5bc1f7093706 /test | |
parent | 6c686ce59342c42b7fdcf54296e28c6c6517e6ab (diff) | |
download | tracifyjs-21794c9b8d0102ed00a15d1e54314908c92e4a24.tar.gz tracifyjs-21794c9b8d0102ed00a15d1e54314908c92e4a24.zip |
account for `catch` variable when `inline` (#2605)
fixes #2604
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/functions.js | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js index 8e67bc32..5f7fba6b 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -847,3 +847,79 @@ issue_2601_2: { } expect_stdout: "PASS" } + +issue_2604_1: { + options = { + inline: true, + side_effects: true, + unused: true, + } + input: { + var a = "FAIL"; + (function() { + try { + throw 1; + } catch (b) { + (function f(b) { + b && b(); + })(); + b && (a = "PASS"); + } + })(); + console.log(a); + } + expect: { + var a = "FAIL"; + (function() { + try { + throw 1; + } catch (b) { + (function(b) { + b && b(); + })(); + b && (a = "PASS"); + } + })(); + console.log(a); + } + expect_stdout: "PASS" +} + +issue_2604_2: { + rename = true + options = { + evaluate: true, + inline: true, + passes: 3, + reduce_vars: true, + side_effects: true, + unused: true, + } + mangle = {} + input: { + var a = "FAIL"; + (function() { + try { + throw 1; + } catch (b) { + (function f(b) { + b && b(); + })(); + b && (a = "PASS"); + } + })(); + console.log(a); + } + expect: { + var a = "FAIL"; + (function() { + try { + throw 1; + } catch (o) { + o && (a = "PASS"); + } + })(); + console.log(a); + } + expect_stdout: "PASS" +} |