Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80728 views
1
labels_1: {
2
options = { if_return: true, conditionals: true, dead_code: true };
3
input: {
4
out: {
5
if (foo) break out;
6
console.log("bar");
7
}
8
};
9
expect: {
10
foo || console.log("bar");
11
}
12
}
13
14
labels_2: {
15
options = { if_return: true, conditionals: true, dead_code: true };
16
input: {
17
out: {
18
if (foo) print("stuff");
19
else break out;
20
console.log("here");
21
}
22
};
23
expect: {
24
if (foo) {
25
print("stuff");
26
console.log("here");
27
}
28
}
29
}
30
31
labels_3: {
32
options = { if_return: true, conditionals: true, dead_code: true };
33
input: {
34
for (var i = 0; i < 5; ++i) {
35
if (i < 3) continue;
36
console.log(i);
37
}
38
};
39
expect: {
40
for (var i = 0; i < 5; ++i)
41
i < 3 || console.log(i);
42
}
43
}
44
45
labels_4: {
46
options = { if_return: true, conditionals: true, dead_code: true };
47
input: {
48
out: for (var i = 0; i < 5; ++i) {
49
if (i < 3) continue out;
50
console.log(i);
51
}
52
};
53
expect: {
54
for (var i = 0; i < 5; ++i)
55
i < 3 || console.log(i);
56
}
57
}
58
59
labels_5: {
60
options = { if_return: true, conditionals: true, dead_code: true };
61
// should keep the break-s in the following
62
input: {
63
while (foo) {
64
if (bar) break;
65
console.log("foo");
66
}
67
out: while (foo) {
68
if (bar) break out;
69
console.log("foo");
70
}
71
};
72
expect: {
73
while (foo) {
74
if (bar) break;
75
console.log("foo");
76
}
77
out: while (foo) {
78
if (bar) break out;
79
console.log("foo");
80
}
81
}
82
}
83
84
labels_6: {
85
input: {
86
out: break out;
87
};
88
expect: {}
89
}
90
91
labels_7: {
92
options = { if_return: true, conditionals: true, dead_code: true };
93
input: {
94
while (foo) {
95
x();
96
y();
97
continue;
98
}
99
};
100
expect: {
101
while (foo) {
102
x();
103
y();
104
}
105
}
106
}
107
108
labels_8: {
109
options = { if_return: true, conditionals: true, dead_code: true };
110
input: {
111
while (foo) {
112
x();
113
y();
114
break;
115
}
116
};
117
expect: {
118
while (foo) {
119
x();
120
y();
121
break;
122
}
123
}
124
}
125
126
labels_9: {
127
options = { if_return: true, conditionals: true, dead_code: true };
128
input: {
129
out: while (foo) {
130
x();
131
y();
132
continue out;
133
z();
134
k();
135
}
136
};
137
expect: {
138
while (foo) {
139
x();
140
y();
141
}
142
}
143
}
144
145
labels_10: {
146
options = { if_return: true, conditionals: true, dead_code: true };
147
input: {
148
out: while (foo) {
149
x();
150
y();
151
break out;
152
z();
153
k();
154
}
155
};
156
expect: {
157
out: while (foo) {
158
x();
159
y();
160
break out;
161
}
162
}
163
}
164
165