aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-09-15 12:47:12 +0100
committerGitHub <noreply@github.com>2020-09-15 19:47:12 +0800
commit335456cf7766938be44e08102efffc94c6cbd07c (patch)
tree2fa574b4393e35e9eaa24a2d00991bad6fda4038 /test
parentd64d0b0bec426f77e0ca73d2463de3c1a2e71c98 (diff)
downloadtracifyjs-335456cf7766938be44e08102efffc94c6cbd07c.tar.gz
tracifyjs-335456cf7766938be44e08102efffc94c6cbd07c.zip
fix corner case in `merge_vars` (#4104)
fixes #4103
Diffstat (limited to 'test')
-rw-r--r--test/compress/merge_vars.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/compress/merge_vars.js b/test/compress/merge_vars.js
index 076668e5..6923fe73 100644
--- a/test/compress/merge_vars.js
+++ b/test/compress/merge_vars.js
@@ -260,3 +260,30 @@ read_before_assign_2: {
}
expect_stdout: "PASS"
}
+
+issue_4103: {
+ options = {
+ merge_vars: true,
+ side_effects: true,
+ toplevel: true,
+ }
+ input: {
+ function f(a) {
+ console.log(a);
+ }
+ var b = 0;
+ var c = f(b++ + (c %= 1 >> console.log(c = 0)));
+ b;
+ }
+ expect: {
+ function f(a) {
+ console.log(a);
+ }
+ var b = 0;
+ var c = f(b++ + (c %= 1 >> console.log(c = 0)));
+ }
+ expect_stdout: [
+ "0",
+ "NaN",
+ ]
+}