aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/collapse_vars.js72
1 files changed, 72 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index baa18ea1..c115763c 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -2711,3 +2711,75 @@ issue_2364_2: {
}
}
}
+
+issue_2364_3: {
+ options = {
+ collapse_vars: true,
+ pure_getters: true,
+ }
+ input: {
+ function inc(obj) {
+ return obj.count++;
+ }
+ function foo(bar) {
+ var result = inc(bar);
+ return foo.amount = bar.count, result;
+ }
+ var data = {
+ count: 0,
+ };
+ var answer = foo(data);
+ console.log(foo.amount, answer);
+ }
+ expect: {
+ function inc(obj) {
+ return obj.count++;
+ }
+ function foo(bar) {
+ var result = inc(bar);
+ return foo.amount = bar.count, result;
+ }
+ var data = {
+ count: 0,
+ };
+ var answer = foo(data);
+ console.log(foo.amount, answer);
+ }
+ expect_stdout: "1 0"
+}
+
+issue_2364_4: {
+ options = {
+ collapse_vars: true,
+ pure_getters: true,
+ }
+ input: {
+ function inc(obj) {
+ return obj.count++;
+ }
+ function foo(bar, baz) {
+ var result = inc(bar);
+ return foo.amount = baz.count, result;
+ }
+ var data = {
+ count: 0,
+ };
+ var answer = foo(data, data);
+ console.log(foo.amount, answer);
+ }
+ expect: {
+ function inc(obj) {
+ return obj.count++;
+ }
+ function foo(bar, baz) {
+ var result = inc(bar);
+ return foo.amount = baz.count, result;
+ }
+ var data = {
+ count: 0,
+ };
+ var answer = foo(data, data);
+ console.log(foo.amount, answer);
+ }
+ expect_stdout: "1 0"
+}