diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/collapse_vars.js | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index 2c7bbdeb..bcb9cb91 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -4546,3 +4546,76 @@ issue_2908: { } expect_stdout: "2" } + +issue_2914_1: { + options = { + collapse_vars: true, + } + input: { + function read(input) { + var i = 0; + var e = 0; + var t = 0; + while (e < 32) { + var n = input[i++]; + t |= (127 & n) << e; + if (0 === (128 & n)) + return t; + e += 7; + } + } + console.log(read([129])); + } + expect: { + function read(input) { + var i = 0; + var e = 0; + var t = 0; + while (e < 32) { + var n = input[i++]; + t |= (127 & n) << e; + if (0 === (128 & n)) + return t; + e += 7; + } + } + console.log(read([129])); + } + expect_stdout: "1" +} + +issue_2914_2: { + options = { + collapse_vars: true, + } + input: { + function read(input) { + var i = 0; + var e = 0; + var t = 0; + while (e < 32) { + var n = input[i++]; + t = (127 & n) << e; + if (0 === (128 & n)) + return t; + e += 7; + } + } + console.log(read([129])); + } + expect: { + function read(input) { + var i = 0; + var e = 0; + var t = 0; + while (e < 32) { + var n = input[i++]; + if (0 === (128 & n)) + return t = (127 & n) << e; + e += 7; + } + } + console.log(read([129])); + } + expect_stdout: "0" +} |