diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2019-03-18 21:24:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-18 21:24:42 +0800 |
commit | 7aa7f21872a443cad6fe496b1a2f66e969b19f09 (patch) | |
tree | 4d16618981ae46ffcc2d2f6399c996281bd20c62 /test/compress | |
parent | 4430a436eb122ebdd0b63d6d3c070375436e1db8 (diff) | |
download | tracifyjs-7aa7f21872a443cad6fe496b1a2f66e969b19f09.tar.gz tracifyjs-7aa7f21872a443cad6fe496b1a2f66e969b19f09.zip |
fix corner case in `evaluate` (#3344)
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/evaluate.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js index c1cb86cd..23785284 100644 --- a/test/compress/evaluate.js +++ b/test/compress/evaluate.js @@ -1610,3 +1610,47 @@ truthy_loops: { } } } + +if_increment: { + options = { + evaluate: true, + reduce_vars: true, + unused: true, + } + input: { + console.log(function(a) { + if (console) + return ++a; + }(0)); + } + expect: { + console.log(function(a) { + if (console) + return 1; + }()); + } + expect_stdout: "1" +} + +try_increment: { + options = { + evaluate: true, + reduce_vars: true, + unused: true, + } + input: { + console.log(function(a) { + try { + return ++a; + } catch (e) {} + }(0)); + } + expect: { + console.log(function(a) { + try { + return 1; + } catch (e) {} + }()); + } + expect_stdout: "1" +} |