aboutsummaryrefslogtreecommitdiff
path: root/test/compress/evaluate.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-10-13 19:49:45 +0100
committerGitHub <noreply@github.com>2020-10-14 02:49:45 +0800
commitb7b8435721a07bebec9fca513700cc2af31ed175 (patch)
tree2a02342a8390dd4d9a999e477117ad3908275447 /test/compress/evaluate.js
parentc0c04c33bb1652014365fa893cc9b7d29684e59a (diff)
downloadtracifyjs-b7b8435721a07bebec9fca513700cc2af31ed175.tar.gz
tracifyjs-b7b8435721a07bebec9fca513700cc2af31ed175.zip
fix corner case in `evaluate` (#4215)
fixes #4214
Diffstat (limited to 'test/compress/evaluate.js')
-rw-r--r--test/compress/evaluate.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js
index 9504afb5..9fa65202 100644
--- a/test/compress/evaluate.js
+++ b/test/compress/evaluate.js
@@ -3014,3 +3014,36 @@ issue_4119_4: {
}
expect_stdout: "PASS"
}
+
+issue_4214: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ function f(a) {
+ return function() {
+ try {
+ return a;
+ } finally {
+ var b = 0;
+ }
+ }(a++ && this());
+ }
+ var c = f();
+ console.log(c);
+ }
+ expect: {
+ var c = function(a) {
+ return function() {
+ try {
+ return a;
+ } finally {}
+ }(a++ && this());
+ }();
+ console.log(c);
+ }
+ expect_stdout: "NaN"
+}