From 10de27ca3d2010f45a1fb86b2707fa82e73b36b2 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Thu, 18 Feb 2021 18:04:33 +0000 Subject: fix corner case in `reduce_vars` (#4665) fixes #4664 --- test/compress/exponentiation.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'test') 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" +} -- cgit v1.2.3