aboutsummaryrefslog
aboutsummaryrefslogtreecommitdiff
path: root/test/compress/pure_getters.js
blob: 25efd7fd3ae3dbb216bbedfbae6017940c42e539 (about) (plain) ' href='#n68'>68697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
2023-11-05home: services: Add 'x11-display' service....* gnu/home/services/desktop.scm (x11-shepherd-service): New procedure. (home-x11-service-type): New variable. (redshift-shepherd-service): Add 'requirement' field. (home-redshift-service-type): Extend 'home-x11-service-type'. * doc/guix.texi (Desktop Home Services): Document it. Change-Id: Ibd46d71cbb80fcdff8dbf3e8dbcfc3b24163bdb6 Ludovic Courtès
strict: {
    options = {
        pure_getters: "strict",
        reduce_funcs: false,
        reduce_vars: false,
        side_effects: true,
        toplevel: true,
    }
    input: {
        var a, b = null, c = {};
        a.prop;
        b.prop;
        c.prop;
        d.prop;
        null.prop;
        (void 0).prop;
        undefined.prop;
    }
    expect: {
        var a, b = null, c = {};
        a.prop;
        b.prop;
        c.prop;
        d.prop;
        null.prop;
        (void 0).prop;
        (void 0).prop;
    }
}

strict_reduce_vars: {
    options = {
        pure_getters: "strict",
        reduce_funcs: true,
        reduce_vars: true,
        side_effects: true,
        toplevel: true,
    }
    input: {
        var a, b = null, c = {};
        a.prop;
        b.prop;
        c.prop;
        d.prop;
        null.prop;
        (void 0).prop;
        undefined.prop;
    }
    expect: {
        var a, b = null, c = {};
        a.prop;
        b.prop;
        d.prop;
        null.prop;
        (void 0).prop;
        (void 0).prop;
    }
}

unsafe: {
    options = {
        pure_getters: true,
        reduce_funcs: false,
        reduce_vars: false,
        side_effects: true,
        toplevel: true,
    }
    input: {
        var a, b = null, c = {};
        a.prop;
        b.prop;
        c.prop;
        d.prop;
        null.prop;
        (void 0).prop;
        undefined.prop;
    }
    expect: {
        var a, b = null, c = {};
        d;
        null.prop;
        (void 0).prop;
        (void 0).prop;
    }
}

unsafe_reduce_vars: {
    options = {
        pure_getters: true,
        reduce_funcs: true,
        reduce_vars: true,
        side_effects: true,
        toplevel: true,
    }
    input: {
        var a, b = null, c = {};
        a.prop;
        b.prop;
        c.prop;
        d.prop;
        null.prop;
        (void 0).prop;
        undefined.prop;
    }
    expect: {
        var a, b = null, c = {};
        d;
        null.prop;
        (void 0).prop;
        (void 0).prop;
    }
}

chained: {
    options = {
        pure_getters: "strict",
        side_effects: true,
    }
    input: {
        a.b.c;
    }
    expect: {
        a.b.c;
    }
}

impure_getter_1: {
    options = {
        pure_getters: "strict",
        side_effects: true,
    }
    input: {
        ({
            get a() {
                console.log(1);
            },
            b: 1
        }).a;
        ({
            get a() {
                console.log(1);
            },
            b: 1
        }).b;
    }
    expect: {
        ({
            get a() {
                console.log(1);
            },
            b: 1
        }).a;
        ({
            get a() {
                console.log(1);
            },
            b: 1
        }).b;
    }
    expect_stdout: "1"
}

impure_getter_2: {
    options = {
        pure_getters: true,
        side_effects: true,
    }
    input: {
        // will produce incorrect output because getter is not pure
        ({
            get a() {
                console.log(1);
            },
            b: 1
        }).a;
        ({
            get a() {
                console.log(1);
            },
            b: 1
        }).b;
    }
    expect: {}
}

issue_2110_1: {
    options = {
        collapse_vars: true,
        pure_getters: "strict",
        reduce_funcs: true,
        reduce_vars: true,
        sequences: true,
        side_effects: true,
        unused: true,
    }
    input: {
        function f() {
            function f() {}
            function g() {
                return this;
            }
            f.g = g;
            return f.g();
        }
        console.log(typeof f());
    }
    expect: {
        function f() {
            function f() {}
            return f.g = function() {
                return this;
            }, f.g();
        }
        console.log(typeof f());
    }
    expect_stdout: "function"
}

issue_2110_2: {
    options = {
        collapse_vars: true,
        pure_getters: "strict",
        reduce_funcs: true,
        reduce_vars: true,
        unused: true,
    }
    input: {
        function f() {
            function f() {}
            function g() {
                return this;
            }
            f.g = g;
            return f.g();
        }
        console.log(typeof f());
    }
    expect: {
        function f() {
            function f() {}
            f.g = function() {
                return this;
            };
            return f.g();
        }
        console.log(typeof f());
    }
    expect_stdout: "function"
}

set_immutable_1: {
    options = {
        collapse_vars: true,
        evaluate: true,
        pure_getters: "strict",
        reduce_funcs: true,
        reduce_vars: true,
        toplevel: true,
        unused: true,
    }
    input: {
        var a = 1;
        a.foo += "";
        if (a.foo) console.log("FAIL");
        else console.log("PASS");
    }
    expect: {
        1..foo += "";
        if (1..foo) console.log("FAIL");
        else console.log("PASS");
    }
    expect_stdout: "PASS"
}

set_immutable_2: {
    options = {
        collapse_vars: true,
        conditionals: true,
        pure_getters: "strict",
        reduce_funcs: true,
        reduce_vars: true,
        sequences: true,
        side_effects: true,
        toplevel: true,
    }
    input: {
        var a = 1;
        a.foo += "";
        if (a.foo) console.log("FAIL");
        else console.log("PASS");
    }
    expect: {
        var a = 1;
        a.foo += "", a.foo ? console.log("FAIL") : console.log("PASS");
    }
    expect_stdout: "PASS"
}

set_immutable_3: {
    options = {
        collapse_vars: true,
        evaluate: true,
        pure_getters: "strict",
        reduce_funcs: true,
        reduce_vars: true,
        toplevel: true,
        unused: true,
    }
    input: {
        "use strict";
        var a = 1;
        a.foo += "";
        if (a.foo) console.log("FAIL");
        else console.log("PASS");
    }
    expect: {
        "use strict";
        1..foo += "";
        if (1..foo) console.log("FAIL");
        else console.log("PASS");
    }
    expect_stdout: true
}

set_immutable_4: {
    options = {
        collapse_vars: true,
        conditionals: true,
        pure_getters: "strict",
        reduce_funcs: true,
        reduce_vars: true,
        sequences: true,
        side_effects: true,
        toplevel: true,
    }
    input: {
        "use strict";
        var a = 1;
        a.foo += "";
        if (a.foo) console.log("FAIL");
        else console.log("PASS");
    }
    expect: {
        "use strict";
        var a = 1;
        a.foo += "", a.foo ? console.log("FAIL") : console.log("PASS");
    }
    expect_stdout: true
}

set_immutable_5: {
    options = {
        collapse_vars: true,
        conditionals: true,
        evaluate: true,
        pure_getters: "strict",
        reduce_funcs: true,
        reduce_vars: true,
        side_effects: true,
        toplevel: true,
        unused: true,
    }
    input: {
        "use strict";
        var a = 1;
        a.foo += "";
        if (a.foo) console.log("FAIL");
        else console.log("PASS");
    }
    expect: {
        "use strict";
        1..foo += "";
        1..foo ? console.log("FAIL") : console.log("PASS");
    }
    expect_stdout: true
}

set_immutable_6: {
    options = {
        collapse_vars: true,
        conditionals: true,
        evaluate: true,
        pure_getters: "strict",
        reduce_funcs: true,
        reduce_vars: true,
        side_effects: true,
        toplevel: true,
        unused: true,
    }
    input: {
        var a = 1;
        a.foo += "";
        if (a.foo) console.log("FAIL");
        else console.log("PASS");
    }
    expect: {
        1..foo ? console.log("FAIL") : console.log("PASS");
    }
    expect_stdout: true
}

set_mutable_1: {
    options = {
        collapse_vars: true,
        evaluate: true,
        pure_getters: "strict",
        reduce_funcs: true,
        reduce_vars: true,
        unused: true,
    }
    input: {
        !function a() {
            a.foo += "";
            if (a.foo) console.log("PASS");
            else console.log("FAIL");
        }();
    }
    expect: {
        !function a() {
            if (a.foo += "") console.log("PASS");
            else console.log("FAIL");
        }();
    }
    expect_stdout: "PASS"
}

set_mutable_2: {
    options = {
        collapse_vars: true,
        conditionals: true,
        pure_getters: "strict",
        reduce_funcs: true,
        reduce_vars: true,
        sequences: true,
        side_effects: true,
    }
    input: {
        !function a() {
            a.foo += "";
            if (a.foo) console.log("PASS");
            else console.log("FAIL");
        }();
    }
    expect: {
        !function a() {
            (a.foo += "") ? console.log("PASS") : console.log("FAIL");
        }();
    }
    expect_stdout: "PASS"
}

issue_2313_1: {
    options = {
        collapse_vars: true,
        conditionals: true,
        pure_getters: "strict",
        sequences: true,
        side_effects: true,
    }
    input: {
        function x() {
            console.log(1);
            return {
                y: function() {
                    console.log(2);
                    return {
                        z: 0
                    };
                }
            };
        }
        x().y().z++;
        if (x().y().z) {
            console.log(3);
        }
    }
    expect: {
        function x() {
            return console.log(1), {
                y: function() {
                    return console.log(2), {
                        z: 0
                    };
                }
            };
        }
        x().y().z++,
        x().y().z && console.log(3);
    }
    expect_stdout: [
        "1",
        "2",
        "1",
        "2",
    ]
}

issue_2313_2: {
    options = {
        collapse_vars: true,
        conditionals: true,
        pure_getters: true,
        sequences: true,
        side_effects: true,
    }
    input: {
        function x() {
            console.log(1);
            return {
                y: function() {
                    console.log(2);
                    return {
                        z: 0
                    };
                }
            };
        }
        x().y().z++;
        if (x().y().z) {
            console.log(3);
        }
    }
    expect: {
        function x() {
            return console.log(1), {
                y: function() {
                    return console.log(2), {
                        z: 0
                    };
                }
            };
        }
        x().y().z++,
        x().y().z && console.log(3);
    }
    expect_stdout: [
        "1",
        "2",
        "1",
        "2",
    ]
}

issue_2313_3: {
    options = {
        collapse_vars: true,
        conditionals: true,
        pure_getters: "strict",
    }
    input: {
        function x() {
            console.log(1);
            return {
                y: function() {
                    console.log(2);
                    return {
                        z: 0
                    };
                }
            };
        }
        x().y().z++;
        if (x().y().z) {
            console.log(3);
        }
    }
    expect: {
        function x() {
            console.log(1);
            return {
                y: function() {
                    console.log(2);
                    return {
                        z: 0
                    };
                }
            };
        }
        x().y().z++;
        x().y().z && console.log(3);
    }
    expect_stdout: [
        "1",
        "2",
        "1",
        "2",
    ]
}

issue_2313_4: {
    options = {
        collapse_vars: true,
        conditionals: true,
        pure_getters: true,
    }
    input: {
        function x() {
            console.log(1);
            return {
                y: function() {
                    console.log(2);
                    return {
                        z: 0
                    };
                }
            };
        }
        x().y().z++;
        if (x().y().z) {
            console.log(3);
        }
    }
    expect: {
        function x() {
            console.log(1);
            return {
                y: function() {
                    console.log(2);
                    return {
                        z: 0
                    };
                }
            };
        }
        x().y().z++;
        x().y().z && console.log(3);
    }
    expect_stdout: [
        "1",
        "2",
        "1",
        "2",
    ]
}

issue_2313_5: {
    options = {
        pure_getters: "strict",
        side_effects: true,
    }
    input: {
        x().y++;
        x().y;
    }
    expect: {
        x().y++;
        x().y;
    }
}

issue_2313_6: {
    options = {
        pure_getters: true,
        side_effects: true,
    }
    input: {
        x().y++;
        x().y;
    }
    expect: {
        x().y++;
        x();
    }
}

issue_2678: {
    options = {
        pure_getters: "strict",
        side_effects: true,
    }
    input: {
        var a = 1, c = "FAIL";
        (function f() {
            (a-- && f()).p;
            return {
                get p() {
                    c = "PASS";
                }
            };
        })();
        console.log(c);
    }
    expect: {
        var a = 1, c = "FAIL";
        (function f() {
            (a-- && f()).p;
            return {
                get p() {
                    c = "PASS";
                }
            };
        })();
        console.log(c);
    }
    expect_stdout: "PASS"
}

issue_2838: {
    options = {
        pure_getters: true,
        side_effects: true,
    }
    input: {
        function f(a, b) {
            (a || b).c = "PASS";
            (function() {
                return f(a, b);
            }).prototype.foo = "bar";
        }
        var o = {};
        f(null, o);
        console.log(o.c);
    }
    expect: {
        function f(a, b) {
            (a || b).c = "PASS";
        }
        var o = {};
        f(null, o);
        console.log(o.c);
    }
    expect_stdout: "PASS"
}

issue_2938_1: {
    options = {
        pure_getters: true,
        unused: true,
    }
    input: {
        function f(a) {
            a.b = "PASS";
        }
        var o = {};
        f(o);
        console.log(o.b);
    }
    expect: {
        function f(a) {
            a.b = "PASS";
        }
        var o = {};
        f(o);
        console.log(o.b);
    }
    expect_stdout: "PASS"
}

issue_2938_2: {
    options = {
        pure_getters: true,
        toplevel: true,
        unused: true,
    }
    input: {
        var Parser = function Parser() {};
        var p = Parser.prototype;
        p.initialContext = function initialContext() {
            console.log("PASS");
        };
        p.braceIsBlock = function() {};
        (new Parser).initialContext();
    }
    expect: {
        var Parser = function() {};
        var p = Parser.prototype;
        p.initialContext = function() {
            console.log("PASS");
        };
        p.braceIsBlock = function() {};
        (new Parser).initialContext();
    }
    expect_stdout: "PASS"
}

issue_2938_3: {
    options = {
        pure_getters: true,
        side_effects: true,
        unused: true,
    }
    input: {
        function f(a) {
            var unused = a.a;
            a.b = "PASS";
            a.c;
        }
        var o = {};
        o.d;
        f(o);
        console.log(o.b);
    }
    expect: {
        function f(a) {
            a.b = "PASS";
        }
        var o = {};
        f(o);
        console.log(o.b);
    }
    expect_stdout: "PASS"
}

issue_2938_4: {
    options = {
        pure_getters: true,
        side_effects: true,
        toplevel: true,
        unused: true,
    }
    input: {
        var Parser = function Parser() {};
        var p = Parser.prototype;
        var unused = p.x;
        p.initialContext = function initialContext() {
            p.y;
            console.log("PASS");
        };
        p.braceIsBlock = function() {};
        (new Parser).initialContext();
    }
    expect: {
        var Parser = function() {};
        var p = Parser.prototype;
        p.initialContext = function() {
            console.log("PASS");
        };
        p.braceIsBlock = function() {};
        (new Parser).initialContext();
    }
    expect_stdout: "PASS"
}

collapse_vars_1_true: {
    options = {
        collapse_vars: true,
        pure_getters: true,
        unused: true,
    }
    input: {
        function f(a, b) {
            for (;;) {
                var c = a.g();
                var d = b.p;
                if (c || d) break;
            }
        }
    }
    expect: {
        function f(a, b) {
            for (;;)
                if (a.g() || b.p) break;
        }
    }
}

collapse_vars_1_false: {
    options = {
        collapse_vars: true,
        pure_getters: false,
        unused: true,
    }
    input: {
        function f(a, b) {
            for (;;) {
                var c = a.g();
                var d = b.p;
                if (c || d) break;
            }
        }
    }
    expect: {
        function f(a, b) {
            for (;;) {
                var c = a.g();
                var d = b.p;
                if (c || d) break;
            }
        }
    }
}

collapse_vars_1_strict: {
    options = {
        collapse_vars: true,
        pure_getters: "strict",
        unused: true,
    }
    input: {
        function f(a, b) {
            for (;;) {
                var c = a.g();
                var d = b.p;
                if (c || d) break;
            }
        }
    }
    expect: {
        function f(a, b) {
            for (;;) {
                var c = a.g();
                var d = b.p;
                if (c || d) break;
            }
        }
    }
}

collapse_vars_2_true: {
    options = {
        collapse_vars: true,
        pure_getters: true,
        reduce_vars: true,
    }
    input: {
        function f() {
            function g() {}
            g.a = function() {};
            g.b = g.a;
            return g;
        }
    }
    expect: {
        function f() {
            function g() {}
            g.b = g.a = function() {};
            return g;
        }
    }
}

collapse_vars_2_false: {
    options = {
        collapse_vars: true,
        pure_getters: false,
        reduce_vars: true,
    }
    input: {
        function f() {
            function g() {}
            g.a = function() {};
            g.b = g.a;
            return g;
        }
    }
    expect: {
        function f() {
            function g() {}
            g.a = function() {};
            g.b = g.a;
            return g;
        }
    }
}

collapse_vars_2_strict: {
    options = {
        collapse_vars: true,
        pure_getters: "strict",
        reduce_vars: true,
    }
    input: {
        function f() {
            function g() {}
            g.a = function() {};
            g.b = g.a;
            return g;
        }
    }
    expect: {
        function f() {
            function g() {}
            g.b = g.a = function() {};
            return g;
        }
    }
}

collapse_rhs_true: {
    options = {
        collapse_vars: true,
        pure_getters: true,
    }
    input: {
        console.log((42..length = "PASS", "PASS"));
        console.log(("foo".length = "PASS", "PASS"));
        console.log((false.length = "PASS", "PASS"));
        console.log((function() {}.length = "PASS", "PASS"));
        console.log(({
            get length() {
                return "FAIL";
            }
        }.length = "PASS", "PASS"));
    }
    expect: {
        console.log(42..length = "PASS");
        console.log("foo".length = "PASS");
        console.log(false.length = "PASS");
        console.log(function() {}.length = "PASS");
        console.log({
            get length() {
                return "FAIL";
            }
        }.length = "PASS");
    }
    expect_stdout: [
        "PASS",
        "PASS",
        "PASS",
        "PASS",
        "PASS",
    ]
}

collapse_rhs_false: {
    options = {
        collapse_vars: true,
        pure_getters: false,
    }
    input: {
        console.log((42..length = "PASS", "PASS"));
        console.log(("foo".length = "PASS", "PASS"));
        console.log((false.length = "PASS", "PASS"));
        console.log((function() {}.length = "PASS", "PASS"));
        console.log(({
            get length() {
                return "FAIL";
            }
        }.length = "PASS", "PASS"));
    }
    expect: {
        console.log(42..length = "PASS");
        console.log("foo".length = "PASS");
        console.log(false.length = "PASS");
        console.log(function() {}.length = "PASS");
        console.log({
            get length() {
                return "FAIL";
            }
        }.length = "PASS");
    }
    expect_stdout: [
        "PASS",
        "PASS",
        "PASS",
        "PASS",
        "PASS",
    ]
}

collapse_rhs_strict: {
    options = {
        collapse_vars: true,
        pure_getters: "strict",
    }
    input: {
        console.log((42..length = "PASS", "PASS"));
        console.log(("foo".length = "PASS", "PASS"));
        console.log((false.length = "PASS", "PASS"));
        console.log((function() {}.length = "PASS", "PASS"));
        console.log(({
            get length() {
                return "FAIL";
            }
        }.length = "PASS", "PASS"));
    }
    expect: {
        console.log(42..length = "PASS");
        console.log("foo".length = "PASS");
        console.log(false.length = "PASS");
        console.log(function() {}.length = "PASS");
        console.log({
            get length() {
                return "FAIL";
            }
        }.length = "PASS");
    }
    expect_stdout: [
        "PASS",
        "PASS",
        "PASS",
        "PASS",
        "PASS",
    ]
}

collapse_rhs_setter: {
    options = {
        collapse_vars: true,
        pure_getters: "strict",
    }
    input: {
        try {
            console.log(({
                set length(v) {
                    throw "PASS";
                }
            }.length = "FAIL", "FAIL"));
        } catch (e) {
            console.log(e);
        }
    }
    expect: {
        try {
            console.log({
                set length(v) {
                    throw "PASS";
                }
            }.length = "FAIL");
        } catch (e) {
            console.log(e);
        }
    }
    expect_stdout: "PASS"
}

collapse_rhs_call: {
    options = {
        collapse_vars: true,
        passes: 2,
        pure_getters: "strict",
        reduce_vars: true,
        toplevel: true,
        unused: true,
    }
    input: {
        var o = {};
        function f() {
            console.log("PASS");
        }
        o.f = f;
        f();
    }
    expect: {
        ({}.f = function() {
            console.log("PASS");
        })();
    }
    expect_stdout: "PASS"
}

collapse_rhs_lhs: {
    options = {
        collapse_vars: true,
        pure_getters: true,
    }
    input: {
        function f(a, b) {
            a.b = b, b += 2;
            console.log(a.b, b);
        }
        f({}, 1);
    }
    expect: {
        function f(a, b) {
            a.b = b, b += 2;
            console.log(a.b, b);
        }
        f({}, 1);
    }
    expect_stdout: "1 3"
}

drop_arguments: {
    options = {
        pure_getters: "strict",
        side_effects: true,
    }
    input: {
        (function() {
            arguments.slice = function() {
                console.log("PASS");
            };
            arguments[42];
            arguments.length;
            arguments.slice();
        })();
    }
    expect: {
        (function() {
            arguments.slice = function() {
                console.log("PASS");
            };
            arguments.slice();
        })();
    }
    expect_stdout: "PASS"
}

issue_3427: {
    options = {
        assignments: true,
        collapse_vars: true,
        inline: true,
        passes: 2,
        pure_getters: "strict",
        sequences: true,
        side_effects: true,
        toplevel: true,
        unused: true,
    }
    input: {
        var a;
        (function(b) {
            b.p = 42;
        })(a || (a = {}));
    }
    expect: {}
    expect_stdout: true
}