11// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22
33exports [` plugins > esbuild 1` ] = `
4- "(() => {
5- // test/utils.ts
6- var fn2 = (a , b ) => a + b ;
4+ "// test/utils.ts
5+ function add(u, v) {
6+ u [0 ] = u [0 ] + v [0 ];
7+ u [1 ] = u [1 ] + v [1 ];
8+ }
9+ var fn2 = (a, b) => a + b;
710
8- // test/test.ts
9- var foo = [4 , 5 ];
10- var bar = [5 , fn2 (6 , 12 )];
11- var ZERO = () => [0 , 0 ];
12- var baz = [33 , 22 ];
13- var _a0 = baz ;
14- var _b1 = ZERO ();
15- _a0 [0 ] = _a0 [0 ] + _b1 [0 ];
16- _a0 [1 ] = _a0 [1 ] + _b1 [1 ];
17- console .log (foo , baz );
18- var _a2 = ZERO ();
19- var _b3 = bar ;
20- _a2 [0 ] = _a2 [0 ] + _b3 [0 ];
21- _a2 [1 ] = _a2 [1 ] + _b3 [1 ];
22- } )();
11+ // test/test.ts
12+ var foo = [4, 5];
13+ var bar = [5, fn2(6, 12)];
14+ var ZERO = () => [0, 0];
15+ var baz = [33, 22];
16+ var _a0 = baz;
17+ var _b1 = ZERO();
18+ _a0[0] = _a0[0] + _b1[0];
19+ _a0[1] = _a0[1] + _b1[1];
20+ console.log(foo, baz);
21+ var _a2 = ZERO();
22+ var _b3 = bar;
23+ _a2[0] = _a2[0] + _b3[0];
24+ _a2[1] = _a2[1] + _b3[1];
25+ var crossProduct = (u, v, dest) => u[0] * v[1] - u[1] * v[0];
26+ var crossProduct2 = crossProduct;
27+ var add2 = add;
28+ function inlined() {
29+ const foo2 = [4 , 5 ];
30+ const bar2 = [5 , fn2 (6 , 12 )];
31+ const baz2 = [33 , 22 ];
32+ for (let i = 0 ; i < 100 ; i ++ ) {
33+ const _a4 = foo2;
34+ const _b5 = bar2;
35+ _a4[0] = _a4[0] + _b5[0];
36+ _a4[1] = _a4[1] + _b5[1];
37+ const _a6 = baz2;
38+ const _b7 = bar2;
39+ _a6[0] = _a6[0] + _b7[0];
40+ _a6[1] = _a6[1] + _b7[1];
41+ const _a8 = foo2;
42+ const _b9 = baz2;
43+ _a8[0] = _a8[0] + _b9[0];
44+ _a8[1] = _a8[1] + _b9[1];
45+ const _a10 = foo2;
46+ const _b11 = bar2;
47+ const _d12 = baz2;
48+ _d12[0] = _a10[0] * _b11[0];
49+ _d12[1] = _a10[1] * _b11[1];
50+ }
51+ return foo2 ;
52+ }
53+ function notInlined() {
54+ const foo2 = [4 , 5 ];
55+ const bar2 = [5 , fn2 (6 , 12 )];
56+ const baz2 = [33 , 22 ];
57+ for (let i = 0 ; i < 100 ; i ++ ) {
58+ add2(foo2 , bar2 );
59+ add2(baz2 , bar2 );
60+ add2(foo2 , baz2 );
61+ crossProduct2(foo2 , bar2 , baz2 );
62+ }
63+ return foo2 ;
64+ }
65+ export {
66+ inlined ,
67+ notInlined
68+ } ;
2369"
2470` ;
2571
2672exports [` plugins > rollup 1` ] = `
27- "'use strict';
73+ "function add(u, v) {
74+ u [0 ] = u [0 ] + v [0 ];
75+ u [1 ] = u [1 ] + v [1 ];
76+ }
77+ var fn2 = function (a, b) { return a + b ; } ;
2878
2979var foo = [4, 5];
3080var ZERO = function () { return [0 , 0 ]; } ;
@@ -37,17 +87,110 @@ _a0[0] = _a0[0] + _b1[0];
3787_a0[1] = _a0[1] + _b1[1];
3888// so that dead code removal doesn't remove the function altogether
3989console.log(foo, baz);
90+ var crossProduct = function (u, v, dest) {
91+ return u [0 ] * v [1 ] - u [1 ] * v [0 ];
92+ } ;
93+ var crossProduct2 = crossProduct;
94+ var add2 = add;
95+ function inlined() {
96+ var foo = [4 , 5 ];
97+ var bar = [5 , fn2 (6 , 12 )];
98+ var baz = [33 , 22 ];
99+ for (var i = 0 ; i < 100 ; i ++ ) {
100+ const _a4 = foo;
101+ const _b5 = bar;
102+ _a4[0] = _a4[0] + _b5[0];
103+ _a4[1] = _a4[1] + _b5[1];
104+ const _a6 = baz;
105+ const _b7 = bar;
106+ _a6[0] = _a6[0] + _b7[0];
107+ _a6[1] = _a6[1] + _b7[1];
108+ const _a8 = foo;
109+ const _b9 = baz;
110+ _a8[0] = _a8[0] + _b9[0];
111+ _a8[1] = _a8[1] + _b9[1];
112+ const _a10 = foo;
113+ const _b11 = bar;
114+ const _d12 = baz;
115+ _d12[0] = _a10[0] * _b11[0];
116+ _d12[1] = _a10[1] * _b11[1];
117+ }
118+ return foo ;
119+ }
120+ function notInlined() {
121+ var foo = [4 , 5 ];
122+ var bar = [5 , fn2 (6 , 12 )];
123+ var baz = [33 , 22 ];
124+ for (var i = 0 ; i < 100 ; i ++ ) {
125+ add2(foo , bar );
126+ add2(baz , bar );
127+ add2(foo , baz );
128+ crossProduct2(foo , bar );
129+ }
130+ return foo ;
131+ }
132+
133+ export { inlined , notInlined } ;
40134"
41135` ;
42136
43137exports [` plugins > vite 1` ] = `
44- "const foo = [4, 5];
138+ "function add(u, v) {
139+ u [0 ] = u [0 ] + v [0 ];
140+ u [1 ] = u [1 ] + v [1 ];
141+ }
142+ const fn2 = (a, b) => a + b;
143+ const foo = [4, 5];
45144const ZERO = () => [0, 0];
46145const baz = [33, 22];
47146const _a0 = baz;
48147const _b1 = ZERO();
49148_a0[0] = _a0[0] + _b1[0];
50149_a0[1] = _a0[1] + _b1[1];
51150console.log(foo, baz);
151+ const crossProduct = (u, v, dest) => u[0] * v[1] - u[1] * v[0];
152+ const crossProduct2 = crossProduct;
153+ const add2 = add;
154+ function inlined() {
155+ const foo2 = [4 , 5 ];
156+ const bar2 = [5 , fn2 (6 , 12 )];
157+ const baz2 = [33 , 22 ];
158+ for (let i = 0 ; i < 100 ; i ++ ) {
159+ const _a4 = foo2;
160+ const _b5 = bar2;
161+ _a4[0] = _a4[0] + _b5[0];
162+ _a4[1] = _a4[1] + _b5[1];
163+ const _a6 = baz2;
164+ const _b7 = bar2;
165+ _a6[0] = _a6[0] + _b7[0];
166+ _a6[1] = _a6[1] + _b7[1];
167+ const _a8 = foo2;
168+ const _b9 = baz2;
169+ _a8[0] = _a8[0] + _b9[0];
170+ _a8[1] = _a8[1] + _b9[1];
171+ const _a10 = foo2;
172+ const _b11 = bar2;
173+ const _d12 = baz2;
174+ _d12[0] = _a10[0] * _b11[0];
175+ _d12[1] = _a10[1] * _b11[1];
176+ }
177+ return foo2 ;
178+ }
179+ function notInlined() {
180+ const foo2 = [4 , 5 ];
181+ const bar2 = [5 , fn2 (6 , 12 )];
182+ const baz2 = [33 , 22 ];
183+ for (let i = 0 ; i < 100 ; i ++ ) {
184+ add2(foo2 , bar2 );
185+ add2(baz2 , bar2 );
186+ add2(foo2 , baz2 );
187+ crossProduct2(foo2 , bar2 );
188+ }
189+ return foo2 ;
190+ }
191+ export {
192+ inlined ,
193+ notInlined
194+ } ;
52195"
53196` ;
0 commit comments