aboutsummaryrefslogtreecommitdiff
keep_name_of_getter: {
    options = {
        unused: true,
    }
    input: {
        a = {
            get foo() {},
        };
    }
    expect: {
        a = {
            get foo() {},
        };
    }
}

keep_name_of_setter: {
    options = {
        unused: true,
    }
    input: {
        a = {
            set foo(v) {},
        };
    }
    expect: {
        a = {
            set foo(v) {},
        };
    }
}

setter_with_operator_keys: {
    input: {
        var tokenCodes = {
            get instanceof() {
                return test0;
            },
            set instanceof(value) {
                test0 = value;
            },
            set typeof(value) {
                test1 = value;
            },
            get typeof() {
                return test1;
            },
            set else(value) {
                test2 = value;
            },
            get else() {
                return test2;
            },
        };
    }
    expect: {
        var tokenCodes = {
            get instanceof() {
                return test0;
            },
            set instanceof(value) {
                test0 = value;
            },
            set typeof(value) {
                test1 = value;
            },
            get typeof() {
                return test1;
            },
            set else(value) {
                test2 = value;
            },
            get else() {
                return test2;
            },
        };
    }
}
/>
1 files changed, 72 insertions, 0 deletions
diff --git a/test/compress/spreads.js b/test/compress/spreads.js
index 7c98fdcd..7eac2482 100644
--- a/test/compress/spreads.js
+++ b/test/compress/spreads.js
@@ -846,3 +846,75 @@ issue_4556: {
expect_stdout: "undefined"
node_version: ">=6"
}
+
+issue_4560_1: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ toplevel: true,
+ }
+ input: {
+ var a = 0;
+ (function(...{
+ [a++]: {},
+ }) {})(2);
+ console.log(a);
+ }
+ expect: {
+ var a = 0;
+ (function(...{
+ [a++]: {},
+ }) {})(2);
+ console.log(a);
+ }
+ expect_stdout: "1"
+ node_version: ">=6"
+}
+
+issue_4560_2: {
+ options = {
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var a = 0;
+ (function(...{
+ [a++]: {},
+ }) {})(2);
+ console.log(a);
+ }
+ expect: {
+ var a = 0;
+ (function(...{
+ [a++]: {},
+ }) {})(2);
+ console.log(a);
+ }
+ expect_stdout: "1"
+ node_version: ">=6"
+}
+
+issue_4560_3: {
+ options = {
+ collapse_vars: true,
+ reduce_vars: true,
+ toplevel: true,
+ }
+ input: {
+ var a = 0, b;
+ [ ...{
+ [a++]: b,
+ } ] = [ "PASS" ];
+ console.log(b);
+ }
+ expect: {
+ var a = 0, b;
+ [ ...{
+ [a++]: b,
+ } ] = [ "PASS" ];
+ console.log(b);
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}