Skip to content

Commit b941b7b

Browse files
authored
[acorn-optimizer] Use 2-space indentation. NFC (#21839)
Also, only set keep_quoted_props in closureFriendly mode.
1 parent 0e4c599 commit b941b7b

19 files changed

+741
-742
lines changed

test/optimizer/AJSDCE-output.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@ var z = fleefl();
55
var zz = fleefl();
66

77
function g(a) {
8-
return a + 1;
8+
return a + 1;
99
}
1010

1111
Module["g"] = g;
1212

1313
function h(a) {
14-
return a + 1;
14+
return a + 1;
1515
}
1616

1717
print(h(123));
1818

1919
(function() {
20-
var z = fleefl();
21-
var zz = fleefl();
22-
function g(a) {
23-
return a + 1;
24-
}
25-
Module["g"] = g;
26-
function hh(a) {
27-
return a + 1;
28-
}
29-
print(hh(123));
20+
var z = fleefl();
21+
var zz = fleefl();
22+
function g(a) {
23+
return a + 1;
24+
}
25+
Module["g"] = g;
26+
function hh(a) {
27+
return a + 1;
28+
}
29+
print(hh(123));
3030
})();
3131

3232
function glue() {

test/optimizer/JSDCE-defaultArg-output.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var usedAsDefaultArg = 42;
33
var usedAsDefaultArg2 = [ 1, 2 ];
44

55
function g({notUsed: notUsed}, a, b = usedAsDefaultArg, [c, d] = usedAsDefaultArg2) {
6-
return a + b + notUsed + 1;
6+
return a + b + notUsed + 1;
77
}
88

99
Module["g"] = g;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function hasOwnProperty(obj, prop) {
2-
return Object.prototype.hasOwnProperty.call(obj, prop);
2+
return Object.prototype.hasOwnProperty.call(obj, prop);
33
}
44

55
if (hasOwnProperty({}, "prop_name")) {
6-
console.log("yeah");
6+
console.log("yeah");
77
}

test/optimizer/JSDCE-objectPattern-output.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ let d = 40;
33
let z = 50;
44

55
globalThis.f = function([, r]) {
6-
let {a: a, b: b} = r;
7-
let {z: c} = r;
8-
let [, i, {foo: p, bar: q}] = r;
9-
return g(a, b, c, d, z);
6+
let {a: a, b: b} = r;
7+
let {z: c} = r;
8+
let [, i, {foo: p, bar: q}] = r;
9+
return g(a, b, c, d, z);
1010
};
1111

1212
let d2 = 40;
1313

1414
globalThis.f2 = function(r2) {
15-
let [a2, b2, c2] = r2;
16-
return g2(a2, b2, c2, d2);
15+
let [a2, b2, c2] = r2;
16+
return g2(a2, b2, c2, d2);
1717
};

test/optimizer/JSDCE-output.js

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,90 +3,90 @@ var z = fleefl();
33
var zz = fleefl();
44

55
var keeperObj = {
6-
x: fleefl()
6+
x: fleefl()
77
};
88

99
var keeperArray = [ 1, 2, "3", four() ];
1010

1111
function g(a) {
12-
return a + 1;
12+
return a + 1;
1313
}
1414

1515
Module["g"] = g;
1616

1717
const sx = {
18-
a: 1
18+
a: 1
1919
};
2020

2121
const sar = [ 1, 2, 3 ];
2222

2323
Module["spread"] = {
24-
b: 2,
25-
...sx
24+
b: 2,
25+
...sx
2626
};
2727

2828
Module["spread2"] = [ ...sar, 4, 5, 6 ];
2929

3030
function h(a) {
31-
return a + 1;
31+
return a + 1;
3232
}
3333

3434
print(h(123));
3535

3636
(function() {
37-
var z = fleefl();
38-
var zz = fleefl();
39-
function g(a) {
40-
return a + 1;
41-
}
42-
Module["g"] = g;
43-
function hh(a) {
44-
return a + 1;
45-
}
46-
print(hh(123));
37+
var z = fleefl();
38+
var zz = fleefl();
39+
function g(a) {
40+
return a + 1;
41+
}
42+
Module["g"] = g;
43+
function hh(a) {
44+
return a + 1;
45+
}
46+
print(hh(123));
4747
})();
4848

4949
function glue() {
50-
function lookup() {
51-
throw 1;
52-
}
50+
function lookup() {
51+
throw 1;
52+
}
5353
}
5454

5555
glue();
5656

5757
function _glCreateShader() {
58-
return 1;
58+
return 1;
5959
}
6060

6161
function emulate() {
62-
_glCreateShader = function _glCreateShader(shaderType) {
63-
return glCreateShader();
64-
};
62+
_glCreateShader = function _glCreateShader(shaderType) {
63+
return glCreateShader();
64+
};
6565
}
6666

6767
emulate();
6868

6969
___cxa_find_matching_catch_before();
7070

7171
function ___cxa_find_matching_catch_before() {
72-
if (!___cxa_find_matching_catch_before.buffer) ___cxa_find_matching_catch_before.buffer = {};
72+
if (!___cxa_find_matching_catch_before.buffer) ___cxa_find_matching_catch_before.buffer = {};
7373
}
7474

7575
function ___cxa_find_matching_catch_after() {
76-
if (!___cxa_find_matching_catch_after.buffer) ___cxa_find_matching_catch_after.buffer = {};
76+
if (!___cxa_find_matching_catch_after.buffer) ___cxa_find_matching_catch_after.buffer = {};
7777
}
7878

7979
___cxa_find_matching_catch_after();
8080

8181
var dotOther = Side.effect;
8282

8383
var FS = {
84-
foo: function(stream, offset, length) {
85-
stream.allocate;
86-
FS;
87-
for (var __exportedFunc in asm) {
88-
var jsname = __exportedFunc;
89-
global_object[jsname] = Module[jsname] = asm[__exportedFunc];
84+
foo: function(stream, offset, length) {
85+
stream.allocate;
86+
FS;
87+
for (var __exportedFunc in asm) {
88+
var jsname = __exportedFunc;
89+
global_object[jsname] = Module[jsname] = asm[__exportedFunc];
90+
}
9091
}
91-
}
9292
};

test/optimizer/applyDCEGraphRemovals-output.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
var name;
22

33
var wasmImports = {
4-
save1: 1,
5-
save2: 2
4+
save1: 1,
5+
save2: 2
66
};
77

88
var expD1 = Module["expD1"] = wasmExports["expD1"];
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
var name;
22

33
var wasmImports = {
4-
a: 1,
5-
A: 33,
6-
b: ___syscall6,
7-
__setErrNo: ___setErrNo,
8-
memset: _memset,
9-
sbrk: _sbrk,
10-
memcpy: _memcpy,
11-
emscripten_memcpy_js: _emscripten_memcpy_js,
12-
c: ___syscall54,
13-
d: ___syscall140,
14-
q: ___syscall146
4+
a: 1,
5+
A: 33,
6+
b: ___syscall6,
7+
__setErrNo: ___setErrNo,
8+
memset: _memset,
9+
sbrk: _sbrk,
10+
memcpy: _memcpy,
11+
emscripten_memcpy_js: _emscripten_memcpy_js,
12+
c: ___syscall54,
13+
d: ___syscall140,
14+
q: ___syscall146
1515
};
1616

1717
var expD1 = Module["expD1"] = wasmExports["c"];
1818

1919
var expI1 = Module["expI1"] = function() {
20-
return wasmExports["d"].apply(null, arguments);
20+
return wasmExports["d"].apply(null, arguments);
2121
};

0 commit comments

Comments
 (0)