diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-08-18 03:54:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-18 10:54:24 +0800 |
commit | 02eb8baa1c6c6f1e79a6e01dfe1e3bd68937eedd (patch) | |
tree | 9ce2d7dc122e8742fc84b73d56b30e2ff25962d3 /test | |
parent | c09f63aefb4609bbdae259213e7fa458d959e20b (diff) | |
download | tracifyjs-02eb8baa1c6c6f1e79a6e01dfe1e3bd68937eedd.tar.gz tracifyjs-02eb8baa1c6c6f1e79a6e01dfe1e3bd68937eedd.zip |
fix corner case in `collapse_vars` (#5113)
fixes #5112
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/collapse_vars.js | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index 4e133768..0df9d72f 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -9412,3 +9412,73 @@ issue_4977_2: { } expect_stdout: "PASS PASS" } + +issue_5112_1: { + options = { + collapse_vars: true, + } + input: { + console.log(function(a) { + try { + try { + if (console + (a = "PASS", "")) + return "FAIL 1"; + a.p; + } catch (e) {} + } finally { + return a; + } + }("FAIL 2")); + } + expect: { + console.log(function(a) { + try { + try { + if (console + (a = "PASS", "")) + return "FAIL 1"; + a.p; + } catch (e) {} + } finally { + return a; + } + }("FAIL 2")); + } + expect_stdout: "PASS" +} + +issue_5112_2: { + options = { + collapse_vars: true, + } + input: { + console.log(function(a) { + try { + return function() { + try { + if (console + (a = "PASS", "")) + return "FAIL 1"; + a.p; + } catch (e) {} + }(); + } finally { + return a; + } + }("FAIL 2")); + } + expect: { + console.log(function(a) { + try { + return function() { + try { + if (console + (a = "PASS", "")) + return "FAIL 1"; + a.p; + } catch (e) {} + }(); + } finally { + return a; + } + }("FAIL 2")); + } + expect_stdout: "PASS" +} |