Skip to content

Commit fb24094

Browse files
Preserve initalizer nodes if they are primitive literals.
1 parent 71afc1b commit fb24094

File tree

75 files changed

+339
-258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+339
-258
lines changed

tests/baselines/reference/classStaticBlock25(target=es2022).js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/baselines/reference/classStaticBlock25(target=es2022).sourcemap.txt

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -214,42 +214,48 @@ sourceFile:classStaticBlock25.ts
214214
2 >^^^^^^^^
215215
3 > ^^^^^^
216216
4 > ^
217-
5 > ^^^^
218-
6 > ^
219-
7 > ^->
217+
5 > ^^^
218+
6 > ^
219+
7 > ^
220+
8 > ^->
220221
1 >
221222
2 >
222223
3 > const
223224
4 > a
224-
5 > = 1
225-
6 > ;
225+
5 > =
226+
6 > 1
227+
7 > ;
226228
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
227229
2 >Emitted(1, 9) Source(1, 1) + SourceIndex(0)
228230
3 >Emitted(1, 15) Source(1, 7) + SourceIndex(0)
229231
4 >Emitted(1, 16) Source(1, 8) + SourceIndex(0)
230-
5 >Emitted(1, 20) Source(1, 12) + SourceIndex(0)
231-
6 >Emitted(1, 21) Source(1, 13) + SourceIndex(0)
232+
5 >Emitted(1, 19) Source(1, 11) + SourceIndex(0)
233+
6 >Emitted(1, 20) Source(1, 12) + SourceIndex(0)
234+
7 >Emitted(1, 21) Source(1, 13) + SourceIndex(0)
232235
---
233236
>>>declare const b = 2;
234237
1->
235238
2 >^^^^^^^^
236239
3 > ^^^^^^
237240
4 > ^
238-
5 > ^^^^
239-
6 > ^
241+
5 > ^^^
242+
6 > ^
243+
7 > ^
240244
1->
241245
>
242246
2 >
243247
3 > const
244248
4 > b
245-
5 > = 2
246-
6 > ;
249+
5 > =
250+
6 > 2
251+
7 > ;
247252
1->Emitted(2, 1) Source(2, 1) + SourceIndex(0)
248253
2 >Emitted(2, 9) Source(2, 1) + SourceIndex(0)
249254
3 >Emitted(2, 15) Source(2, 7) + SourceIndex(0)
250255
4 >Emitted(2, 16) Source(2, 8) + SourceIndex(0)
251-
5 >Emitted(2, 20) Source(2, 12) + SourceIndex(0)
252-
6 >Emitted(2, 21) Source(2, 13) + SourceIndex(0)
256+
5 >Emitted(2, 19) Source(2, 11) + SourceIndex(0)
257+
6 >Emitted(2, 20) Source(2, 12) + SourceIndex(0)
258+
7 >Emitted(2, 21) Source(2, 13) + SourceIndex(0)
253259
---
254260
>>>declare class C {
255261
1 >

tests/baselines/reference/classStaticBlock25(target=esnext).js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/baselines/reference/classStaticBlock25(target=esnext).sourcemap.txt

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -214,42 +214,48 @@ sourceFile:classStaticBlock25.ts
214214
2 >^^^^^^^^
215215
3 > ^^^^^^
216216
4 > ^
217-
5 > ^^^^
218-
6 > ^
219-
7 > ^->
217+
5 > ^^^
218+
6 > ^
219+
7 > ^
220+
8 > ^->
220221
1 >
221222
2 >
222223
3 > const
223224
4 > a
224-
5 > = 1
225-
6 > ;
225+
5 > =
226+
6 > 1
227+
7 > ;
226228
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
227229
2 >Emitted(1, 9) Source(1, 1) + SourceIndex(0)
228230
3 >Emitted(1, 15) Source(1, 7) + SourceIndex(0)
229231
4 >Emitted(1, 16) Source(1, 8) + SourceIndex(0)
230-
5 >Emitted(1, 20) Source(1, 12) + SourceIndex(0)
231-
6 >Emitted(1, 21) Source(1, 13) + SourceIndex(0)
232+
5 >Emitted(1, 19) Source(1, 11) + SourceIndex(0)
233+
6 >Emitted(1, 20) Source(1, 12) + SourceIndex(0)
234+
7 >Emitted(1, 21) Source(1, 13) + SourceIndex(0)
232235
---
233236
>>>declare const b = 2;
234237
1->
235238
2 >^^^^^^^^
236239
3 > ^^^^^^
237240
4 > ^
238-
5 > ^^^^
239-
6 > ^
241+
5 > ^^^
242+
6 > ^
243+
7 > ^
240244
1->
241245
>
242246
2 >
243247
3 > const
244248
4 > b
245-
5 > = 2
246-
6 > ;
249+
5 > =
250+
6 > 2
251+
7 > ;
247252
1->Emitted(2, 1) Source(2, 1) + SourceIndex(0)
248253
2 >Emitted(2, 9) Source(2, 1) + SourceIndex(0)
249254
3 >Emitted(2, 15) Source(2, 7) + SourceIndex(0)
250255
4 >Emitted(2, 16) Source(2, 8) + SourceIndex(0)
251-
5 >Emitted(2, 20) Source(2, 12) + SourceIndex(0)
252-
6 >Emitted(2, 21) Source(2, 13) + SourceIndex(0)
256+
5 >Emitted(2, 19) Source(2, 11) + SourceIndex(0)
257+
6 >Emitted(2, 20) Source(2, 12) + SourceIndex(0)
258+
7 >Emitted(2, 21) Source(2, 13) + SourceIndex(0)
253259
---
254260
>>>declare class C {
255261
1 >

tests/baselines/reference/declarationEmitClassMemberNameConflict2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var Foo = /** @class */ (function () {
4646

4747

4848
//// [declarationEmitClassMemberNameConflict2.d.ts]
49-
declare const Bar = "bar";
49+
declare const Bar = 'bar';
5050
declare enum Hello {
5151
World = 0
5252
}

tests/baselines/reference/declarationEmitConstantNoWidening.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ exports.Bar = Bar;
2121

2222

2323
//// [declarationEmitConstantNoWidening.d.ts]
24-
export declare const FOO = "FOO";
24+
export declare const FOO = 'FOO';
2525
export declare class Bar {
2626
readonly type = "FOO";
2727
}

tests/baselines/reference/fakeInfinity1.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ export type NegativeInfinity = -1e999;
4343
export type TypeOfInfinity = typeof Infinity;
4444
export type TypeOfNaN = typeof NaN;
4545
export type Oops = 123456789123456789123456789123456789123456789123456789;
46-
export declare const oops = 1.2345678912345678e+53;
46+
export declare const oops = 123456789123456789123456789123456789123456789123456789;

tests/baselines/reference/strictPropertyInitialization.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ declare class C11 {
351351
a: number;
352352
constructor();
353353
}
354-
declare const a = "a";
354+
declare const a = 'a';
355355
declare const b: unique symbol;
356356
declare class C12 {
357357
[a]: number;

tests/baselines/reference/tsbuild/amdModulesWithOut/modules-and-globals-mixed-in-amd.js

Lines changed: 58 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ declare const myVar = 30;
9999
//# sourceMappingURL=module.d.ts.map
100100

101101
//// [/src/app/module.d.ts.map]
102-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["file3.ts","file4.ts"],"names":[],"mappings":";IAAA,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;ACApB,QAAA,MAAM,KAAK,KAAK,CAAC"}
102+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["file3.ts","file4.ts"],"names":[],"mappings":";IAAA,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;;ACApB,QAAA,MAAM,KAAK,GAAG,EAAE,CAAC"}
103103

104104
//// [/src/app/module.d.ts.map.baseline.txt]
105105
===================================================================
@@ -119,22 +119,25 @@ sourceFile:file3.ts
119119
3 > ^
120120
4 > ^^^^^^
121121
5 > ^
122-
6 > ^^^^^
123-
7 > ^
122+
6 > ^^^
123+
7 > ^^
124+
8 > ^
124125
1 >
125126
2 > export
126127
3 >
127128
4 > const
128129
5 > z
129-
6 > = 30
130-
7 > ;
130+
6 > =
131+
7 > 30
132+
8 > ;
131133
1 >Emitted(2, 5) Source(1, 1) + SourceIndex(0)
132134
2 >Emitted(2, 11) Source(1, 7) + SourceIndex(0)
133135
3 >Emitted(2, 12) Source(1, 8) + SourceIndex(0)
134136
4 >Emitted(2, 18) Source(1, 14) + SourceIndex(0)
135137
5 >Emitted(2, 19) Source(1, 15) + SourceIndex(0)
136-
6 >Emitted(2, 24) Source(1, 20) + SourceIndex(0)
137-
7 >Emitted(2, 25) Source(1, 21) + SourceIndex(0)
138+
6 >Emitted(2, 22) Source(1, 18) + SourceIndex(0)
139+
7 >Emitted(2, 24) Source(1, 20) + SourceIndex(0)
140+
8 >Emitted(2, 25) Source(1, 21) + SourceIndex(0)
138141
---
139142
-------------------------------------------------------------------
140143
emittedFile:/src/app/module.d.ts
@@ -146,21 +149,24 @@ sourceFile:file4.ts
146149
2 >^^^^^^^^
147150
3 > ^^^^^^
148151
4 > ^^^^^
149-
5 > ^^^^^
150-
6 > ^
151-
7 > ^^^^^^^^^^->
152+
5 > ^^^
153+
6 > ^^
154+
7 > ^
155+
8 > ^^^^^^^^^^->
152156
1 >
153157
2 >
154158
3 > const
155159
4 > myVar
156-
5 > = 30
157-
6 > ;
160+
5 > =
161+
6 > 30
162+
7 > ;
158163
1 >Emitted(4, 1) Source(1, 1) + SourceIndex(1)
159164
2 >Emitted(4, 9) Source(1, 1) + SourceIndex(1)
160165
3 >Emitted(4, 15) Source(1, 7) + SourceIndex(1)
161166
4 >Emitted(4, 20) Source(1, 12) + SourceIndex(1)
162-
5 >Emitted(4, 25) Source(1, 17) + SourceIndex(1)
163-
6 >Emitted(4, 26) Source(1, 18) + SourceIndex(1)
167+
5 >Emitted(4, 23) Source(1, 15) + SourceIndex(1)
168+
6 >Emitted(4, 25) Source(1, 17) + SourceIndex(1)
169+
7 >Emitted(4, 26) Source(1, 18) + SourceIndex(1)
164170
---
165171
>>>//# sourceMappingURL=module.d.ts.map
166172

@@ -296,7 +302,7 @@ declare const globalConst = 10;
296302
//# sourceMappingURL=module.d.ts.map
297303

298304
//// [/src/lib/module.d.ts.map]
299-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["file0.ts","file1.ts","file2.ts","global.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM,KAAK,CAAC;;ICAlB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;;ICApB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;ACApB,QAAA,MAAM,WAAW,KAAK,CAAC"}
305+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["file0.ts","file1.ts","file2.ts","global.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM,GAAG,EAAE,CAAC;;ICAlB,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;;;ICApB,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;;ACApB,QAAA,MAAM,WAAW,GAAG,EAAE,CAAC"}
300306

301307
//// [/src/lib/module.d.ts.map.baseline.txt]
302308
===================================================================
@@ -314,20 +320,23 @@ sourceFile:file0.ts
314320
2 >^^^^^^^^
315321
3 > ^^^^^^
316322
4 > ^^^^^^
317-
5 > ^^^^^
318-
6 > ^
323+
5 > ^^^
324+
6 > ^^
325+
7 > ^
319326
1 >
320327
2 >
321328
3 > const
322329
4 > myGlob
323-
5 > = 20
324-
6 > ;
330+
5 > =
331+
6 > 20
332+
7 > ;
325333
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
326334
2 >Emitted(1, 9) Source(1, 1) + SourceIndex(0)
327335
3 >Emitted(1, 15) Source(1, 7) + SourceIndex(0)
328336
4 >Emitted(1, 21) Source(1, 13) + SourceIndex(0)
329-
5 >Emitted(1, 26) Source(1, 18) + SourceIndex(0)
330-
6 >Emitted(1, 27) Source(1, 19) + SourceIndex(0)
337+
5 >Emitted(1, 24) Source(1, 16) + SourceIndex(0)
338+
6 >Emitted(1, 26) Source(1, 18) + SourceIndex(0)
339+
7 >Emitted(1, 27) Source(1, 19) + SourceIndex(0)
331340
---
332341
-------------------------------------------------------------------
333342
emittedFile:/src/lib/module.d.ts
@@ -340,22 +349,25 @@ sourceFile:file1.ts
340349
3 > ^
341350
4 > ^^^^^^
342351
5 > ^
343-
6 > ^^^^^
344-
7 > ^
352+
6 > ^^^
353+
7 > ^^
354+
8 > ^
345355
1 >
346356
2 > export
347357
3 >
348358
4 > const
349359
5 > x
350-
6 > = 10
351-
7 > ;
360+
6 > =
361+
7 > 10
362+
8 > ;
352363
1 >Emitted(3, 5) Source(1, 1) + SourceIndex(1)
353364
2 >Emitted(3, 11) Source(1, 7) + SourceIndex(1)
354365
3 >Emitted(3, 12) Source(1, 8) + SourceIndex(1)
355366
4 >Emitted(3, 18) Source(1, 14) + SourceIndex(1)
356367
5 >Emitted(3, 19) Source(1, 15) + SourceIndex(1)
357-
6 >Emitted(3, 24) Source(1, 20) + SourceIndex(1)
358-
7 >Emitted(3, 25) Source(1, 21) + SourceIndex(1)
368+
6 >Emitted(3, 22) Source(1, 18) + SourceIndex(1)
369+
7 >Emitted(3, 24) Source(1, 20) + SourceIndex(1)
370+
8 >Emitted(3, 25) Source(1, 21) + SourceIndex(1)
359371
---
360372
-------------------------------------------------------------------
361373
emittedFile:/src/lib/module.d.ts
@@ -369,22 +381,25 @@ sourceFile:file2.ts
369381
3 > ^
370382
4 > ^^^^^^
371383
5 > ^
372-
6 > ^^^^^
373-
7 > ^
384+
6 > ^^^
385+
7 > ^^
386+
8 > ^
374387
1 >
375388
2 > export
376389
3 >
377390
4 > const
378391
5 > y
379-
6 > = 20
380-
7 > ;
392+
6 > =
393+
7 > 20
394+
8 > ;
381395
1 >Emitted(6, 5) Source(1, 1) + SourceIndex(2)
382396
2 >Emitted(6, 11) Source(1, 7) + SourceIndex(2)
383397
3 >Emitted(6, 12) Source(1, 8) + SourceIndex(2)
384398
4 >Emitted(6, 18) Source(1, 14) + SourceIndex(2)
385399
5 >Emitted(6, 19) Source(1, 15) + SourceIndex(2)
386-
6 >Emitted(6, 24) Source(1, 20) + SourceIndex(2)
387-
7 >Emitted(6, 25) Source(1, 21) + SourceIndex(2)
400+
6 >Emitted(6, 22) Source(1, 18) + SourceIndex(2)
401+
7 >Emitted(6, 24) Source(1, 20) + SourceIndex(2)
402+
8 >Emitted(6, 25) Source(1, 21) + SourceIndex(2)
388403
---
389404
-------------------------------------------------------------------
390405
emittedFile:/src/lib/module.d.ts
@@ -396,21 +411,24 @@ sourceFile:global.ts
396411
2 >^^^^^^^^
397412
3 > ^^^^^^
398413
4 > ^^^^^^^^^^^
399-
5 > ^^^^^
400-
6 > ^
401-
7 > ^^^^->
414+
5 > ^^^
415+
6 > ^^
416+
7 > ^
417+
8 > ^^^^->
402418
1 >
403419
2 >
404420
3 > const
405421
4 > globalConst
406-
5 > = 10
407-
6 > ;
422+
5 > =
423+
6 > 10
424+
7 > ;
408425
1 >Emitted(8, 1) Source(1, 1) + SourceIndex(3)
409426
2 >Emitted(8, 9) Source(1, 1) + SourceIndex(3)
410427
3 >Emitted(8, 15) Source(1, 7) + SourceIndex(3)
411428
4 >Emitted(8, 26) Source(1, 18) + SourceIndex(3)
412-
5 >Emitted(8, 31) Source(1, 23) + SourceIndex(3)
413-
6 >Emitted(8, 32) Source(1, 24) + SourceIndex(3)
429+
5 >Emitted(8, 29) Source(1, 21) + SourceIndex(3)
430+
6 >Emitted(8, 31) Source(1, 23) + SourceIndex(3)
431+
7 >Emitted(8, 32) Source(1, 24) + SourceIndex(3)
414432
---
415433
>>>//# sourceMappingURL=module.d.ts.map
416434

0 commit comments

Comments
 (0)