Skip to content

Commit 2d9b106

Browse files
authored
Improve testing before refactoring minifyLocals (#13618)
1 parent 1fb4802 commit 2d9b106

File tree

2 files changed

+76
-3
lines changed

2 files changed

+76
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,40 @@
1-
function a() {
1+
function a(a) {
22
b();
33
}
4+
5+
function b() {}
6+
7+
function c() {
8+
var a = 10;
9+
return a;
10+
}
11+
12+
function d(f, g, h) {
13+
var i, j, k, l;
14+
i = f;
15+
j = g;
16+
k = h;
17+
l = f;
18+
return f + g + h + i + j + k + l;
19+
}
20+
21+
function l() {
22+
a : while (1) {
23+
b : while (1) {
24+
if (c()) {
25+
if (d()) {
26+
break a;
27+
} else {
28+
continue b;
29+
}
30+
} else {
31+
if (d()) {
32+
break;
33+
} else {
34+
continue;
35+
}
36+
}
37+
}
38+
}
39+
a : while (1) {}
40+
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,41 @@
1-
function main() {
1+
function main(x) {
22
constructor(); // special word in JS, must not be confused by it
33
}
4+
function constructor() {
5+
}
6+
function foo() {
7+
var bar = 10;
8+
return bar;
9+
}
10+
function bar(foo, a, b) {
11+
var main, c, d, e;
12+
main = foo;
13+
c = a;
14+
d = b;
15+
e = foo;
16+
return foo + a + b + main + c + d + e;
17+
}
18+
function labels() {
19+
L1: while (1) {
20+
L2: while (1) {
21+
if (foo()) {
22+
if (bar()) {
23+
break L1;
24+
} else {
25+
continue L2;
26+
}
27+
} else {
28+
if (bar()) {
29+
break;
30+
} else {
31+
continue;
32+
}
33+
}
34+
}
35+
}
36+
// Another loop with the same name
37+
L1: while (1) {
38+
}
39+
}
440
// EMSCRIPTEN_GENERATED_FUNCTIONS
5-
// EXTRA_INFO: { "names": ["a", "b", "c", "d", "e", "f", "g", "h", "i", "i1", "cl"], "globals": { "main": "a", "constructor": "b" } }
41+
// EXTRA_INFO: { "globals": { "main": "a", "constructor": "b", "foo": "c", "bar": "d", "labels": "l" } }

0 commit comments

Comments
 (0)