aboutsummaryrefslogtreecommitdiff
path: root/test/compress/return_undefined.js
blob: 9662aa51f776f022a8c9595e2995c8692fc63c07 (about) (plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
return_undefined: {
    options = {
        sequences     : false,
        if_return     : true,
        evaluate      : true,
        dead_code     : true,
        conditionals  : true,
        comparisons   : true,
        booleans      : true,
        unused        : true,
        side_effects  : true,
        properties    : true,
        drop_debugger : true,
        loops         : true,
        hoist_funs    : true,
        keep_fargs    : true,
        keep_fnames   : false,
        hoist_vars    : true,
        join_vars     : true,
        cascade       : true,
        negate_iife   : true
    };
    input: {
        function f0() {
        }
        function f1() {
            return undefined;
        }
        function f2() {
            return void 0;
        }
        function f3() {
            return void 123;
        }
        function f4() {
            return;
        }
        function f5(a, b) {
            console.log(a, b);
            baz(a);
            return;
        }
        function f6(a, b) {
            console.log(a, b);
            if (a) {
                foo(b);
                baz(a);
                return a + b;
            }
            return undefined;
        }
        function f7(a, b) {
            console.log(a, b);
            if (a) {
                foo(b);
                baz(a);
                return void 0;
            }
            return a + b;
        }
        function f8(a, b) {
            foo(a);
            bar(b);
            return void 0;
        }
        function f9(a, b) {
            foo(a);
            bar(b);
            return undefined;
        }
        function f10() {
            return false;
        }
        function f11() {
            return null;
        }
        function f12() {
            return 0;
        }
    }
    expect: {
        function f0() {}
        function f1() {}
        function f2() {}
        function f3() {}
        function f4() {}
        function f5(a, b) {
            console.log(a, b);
            baz(a);
        }
        function f6(a, b) {
            console.log(a, b);
            if (a) {
                foo(b);
                baz(a);
                return a + b;
            }
        }
        function f7(a, b) {
            console.log(a, b);
            if (!a)
                return a + b;
            foo(b);
            baz(a);
        }
        function f8(a, b) {
            foo(a);
            bar(b);
        }
        function f9(a, b) {
            foo(a);
            bar(b);
        }
        function f10() {
            return !1;
        }
        function f11() {
            return null;
        }
        function f12() {
            return 0;
        }
    }
}