aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-02-18 18:04:33 +0000
committerGitHub <noreply@github.com>2021-02-19 02:04:33 +0800
commit10de27ca3d2010f45a1fb86b2707fa82e73b36b2 (patch)
tree71622ee56844fba68a0b57f52ea263f3092b39e2 /test
parent7b4fd858ba23e6c1402ad33d8cc4a8a8e7966614 (diff)
downloadtracifyjs-10de27ca3d2010f45a1fb86b2707fa82e73b36b2.tar.gz
tracifyjs-10de27ca3d2010f45a1fb86b2707fa82e73b36b2.zip
fix corner case in `reduce_vars` (#4665)
fixes #4664
Diffstat (limited to 'test')
-rw-r--r--test/compress/exponentiation.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/compress/exponentiation.js b/test/compress/exponentiation.js
index 008d5871..b6cfde51 100644
--- a/test/compress/exponentiation.js
+++ b/test/compress/exponentiation.js
@@ -56,3 +56,31 @@ evaluate: {
expect_stdout: "5"
node_version: ">=8"
}
+
+issue_4664: {
+ options = {
+ collapse_vars: true,
+ evaluate: true,
+ reduce_vars: true,
+ side_effects: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ function f() {
+ new function(a) {
+ console.log(typeof f, a, typeof this);
+ }((A = 0, (NaN ^ 1) * 2 ** 30), 0);
+ }
+ f();
+ }
+ expect: {
+ (function f() {
+ new function(a) {
+ console.log(typeof f, 2 ** 30, typeof this);
+ }(0, A = 0);
+ })();
+ }
+ expect_stdout: "function 1073741824 object"
+ node_version: ">=8"
+}