@@ -11,6 +11,8 @@ import (
11
11
"gotest.tools/v3/assert"
12
12
)
13
13
14
+ var defaultSourceFileAffectingOptions = (& core.CompilerOptions {}).SourceFileAffecting ()
15
+
14
16
func TestTempVariable1 (t * testing.T ) {
15
17
t .Parallel ()
16
18
@@ -257,7 +259,7 @@ func TestGeneratedNameForIdentifier1(t *testing.T) {
257
259
ec := printer .NewEmitContext ()
258
260
259
261
file := parsetestutil .ParseTypeScript ("function f() {}" , false /*jsx*/ )
260
- binder .BindSourceFile (file , & core. CompilerOptions {} )
262
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
261
263
262
264
n := file .Statements .Nodes [0 ].Name ()
263
265
name1 := ec .NewGeneratedNameForNode (n , printer.AutoGenerateOptions {})
@@ -274,7 +276,7 @@ func TestGeneratedNameForIdentifier2(t *testing.T) {
274
276
ec := printer .NewEmitContext ()
275
277
276
278
file := parsetestutil .ParseTypeScript ("function f() {}" , false /*jsx*/ )
277
- binder .BindSourceFile (file , & core. CompilerOptions {} )
279
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
278
280
279
281
n := file .Statements .Nodes [0 ].Name ()
280
282
name1 := ec .NewGeneratedNameForNode (n , printer.AutoGenerateOptions {
@@ -294,7 +296,7 @@ func TestGeneratedNameForIdentifier3(t *testing.T) {
294
296
ec := printer .NewEmitContext ()
295
297
296
298
file := parsetestutil .ParseTypeScript ("function f() {}" , false /*jsx*/ )
297
- binder .BindSourceFile (file , & core. CompilerOptions {} )
299
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
298
300
299
301
n := file .Statements .Nodes [0 ].Name ()
300
302
name1 := ec .NewGeneratedNameForNode (n , printer.AutoGenerateOptions {
@@ -316,7 +318,7 @@ func TestGeneratedNameForNamespace1(t *testing.T) {
316
318
ec := printer .NewEmitContext ()
317
319
318
320
file := parsetestutil .ParseTypeScript ("namespace foo { }" , false /*jsx*/ )
319
- binder .BindSourceFile (file , & core. CompilerOptions {} )
321
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
320
322
321
323
ns1 := file .Statements .Nodes [0 ]
322
324
name1 := ec .NewGeneratedNameForNode (ns1 , printer.AutoGenerateOptions {})
@@ -334,7 +336,7 @@ func TestGeneratedNameForNamespace2(t *testing.T) {
334
336
ec := printer .NewEmitContext ()
335
337
336
338
file := parsetestutil .ParseTypeScript ("namespace foo { var foo; }" , false /*jsx*/ )
337
- binder .BindSourceFile (file , & core. CompilerOptions {} )
339
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
338
340
339
341
ns1 := file .Statements .Nodes [0 ]
340
342
name1 := ec .NewGeneratedNameForNode (ns1 , printer.AutoGenerateOptions {})
@@ -352,7 +354,7 @@ func TestGeneratedNameForNamespace3(t *testing.T) {
352
354
ec := printer .NewEmitContext ()
353
355
354
356
file := parsetestutil .ParseTypeScript ("namespace ns1 { namespace foo { var foo; } } namespace ns2 { namespace foo { var foo; } }" , false /*jsx*/ )
355
- binder .BindSourceFile (file , & core. CompilerOptions {} )
357
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
356
358
357
359
ns1 := file .Statements .Nodes [0 ].AsModuleDeclaration ().Body .AsModuleBlock ().Statements .Nodes [0 ]
358
360
ns2 := file .Statements .Nodes [1 ].AsModuleDeclaration ().Body .AsModuleBlock ().Statements .Nodes [0 ]
@@ -374,7 +376,7 @@ func TestGeneratedNameForNamespace4(t *testing.T) {
374
376
ec := printer .NewEmitContext ()
375
377
376
378
file := parsetestutil .ParseTypeScript ("namespace ns1 { namespace foo { var foo; } } namespace ns2 { namespace foo { var foo; } }" , false /*jsx*/ )
377
- binder .BindSourceFile (file , & core. CompilerOptions {} )
379
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
378
380
379
381
ns1 := file .Statements .Nodes [0 ].AsModuleDeclaration ().Body .AsModuleBlock ().Statements .Nodes [0 ]
380
382
ns2 := file .Statements .Nodes [1 ].AsModuleDeclaration ().Body .AsModuleBlock ().Statements .Nodes [0 ]
@@ -400,7 +402,7 @@ func TestGeneratedNameForNodeCached(t *testing.T) {
400
402
ec := printer .NewEmitContext ()
401
403
402
404
file := parsetestutil .ParseTypeScript ("namespace foo { var foo; }" , false /*jsx*/ )
403
- binder .BindSourceFile (file , & core. CompilerOptions {} )
405
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
404
406
405
407
ns1 := file .Statements .Nodes [0 ]
406
408
name1 := ec .NewGeneratedNameForNode (ns1 , printer.AutoGenerateOptions {})
@@ -420,7 +422,7 @@ func TestGeneratedNameForImport(t *testing.T) {
420
422
ec := printer .NewEmitContext ()
421
423
422
424
file := parsetestutil .ParseTypeScript ("import * as foo from 'foo'" , false /*jsx*/ )
423
- binder .BindSourceFile (file , & core. CompilerOptions {} )
425
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
424
426
425
427
n := file .Statements .Nodes [0 ]
426
428
name1 := ec .NewGeneratedNameForNode (n , printer.AutoGenerateOptions {})
@@ -437,7 +439,7 @@ func TestGeneratedNameForExport(t *testing.T) {
437
439
ec := printer .NewEmitContext ()
438
440
439
441
file := parsetestutil .ParseTypeScript ("export * as foo from 'foo'" , false /*jsx*/ )
440
- binder .BindSourceFile (file , & core. CompilerOptions {} )
442
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
441
443
442
444
n := file .Statements .Nodes [0 ]
443
445
name1 := ec .NewGeneratedNameForNode (n , printer.AutoGenerateOptions {})
@@ -454,7 +456,7 @@ func TestGeneratedNameForFunctionDeclaration1(t *testing.T) {
454
456
ec := printer .NewEmitContext ()
455
457
456
458
file := parsetestutil .ParseTypeScript ("export function f() {}" , false /*jsx*/ )
457
- binder .BindSourceFile (file , & core. CompilerOptions {} )
459
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
458
460
459
461
n := file .Statements .Nodes [0 ]
460
462
name1 := ec .NewGeneratedNameForNode (n , printer.AutoGenerateOptions {})
@@ -471,7 +473,7 @@ func TestGeneratedNameForFunctionDeclaration2(t *testing.T) {
471
473
ec := printer .NewEmitContext ()
472
474
473
475
file := parsetestutil .ParseTypeScript ("export default function () {}" , false /*jsx*/ )
474
- binder .BindSourceFile (file , & core. CompilerOptions {} )
476
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
475
477
476
478
n := file .Statements .Nodes [0 ]
477
479
name1 := ec .NewGeneratedNameForNode (n , printer.AutoGenerateOptions {})
@@ -488,7 +490,7 @@ func TestGeneratedNameForClassDeclaration1(t *testing.T) {
488
490
ec := printer .NewEmitContext ()
489
491
490
492
file := parsetestutil .ParseTypeScript ("export class C {}" , false /*jsx*/ )
491
- binder .BindSourceFile (file , & core. CompilerOptions {} )
493
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
492
494
493
495
n := file .Statements .Nodes [0 ]
494
496
name1 := ec .NewGeneratedNameForNode (n , printer.AutoGenerateOptions {})
@@ -505,7 +507,7 @@ func TestGeneratedNameForClassDeclaration2(t *testing.T) {
505
507
ec := printer .NewEmitContext ()
506
508
507
509
file := parsetestutil .ParseTypeScript ("export default class {}" , false /*jsx*/ )
508
- binder .BindSourceFile (file , & core. CompilerOptions {} )
510
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
509
511
510
512
n := file .Statements .Nodes [0 ]
511
513
name1 := ec .NewGeneratedNameForNode (n , printer.AutoGenerateOptions {})
@@ -522,7 +524,7 @@ func TestGeneratedNameForExportAssignment(t *testing.T) {
522
524
ec := printer .NewEmitContext ()
523
525
524
526
file := parsetestutil .ParseTypeScript ("export default 0" , false /*jsx*/ )
525
- binder .BindSourceFile (file , & core. CompilerOptions {} )
527
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
526
528
527
529
n := file .Statements .Nodes [0 ]
528
530
name1 := ec .NewGeneratedNameForNode (n , printer.AutoGenerateOptions {})
@@ -539,7 +541,7 @@ func TestGeneratedNameForClassExpression(t *testing.T) {
539
541
ec := printer .NewEmitContext ()
540
542
541
543
file := parsetestutil .ParseTypeScript ("(class {})" , false /*jsx*/ )
542
- binder .BindSourceFile (file , & core. CompilerOptions {} )
544
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
543
545
544
546
n := file .Statements .Nodes [0 ].AsExpressionStatement ().Expression .AsParenthesizedExpression ().Expression
545
547
name1 := ec .NewGeneratedNameForNode (n , printer.AutoGenerateOptions {})
@@ -556,7 +558,7 @@ func TestGeneratedNameForMethod1(t *testing.T) {
556
558
ec := printer .NewEmitContext ()
557
559
558
560
file := parsetestutil .ParseTypeScript ("class C { m() {} }" , false /*jsx*/ )
559
- binder .BindSourceFile (file , & core. CompilerOptions {} )
561
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
560
562
561
563
n := file .Statements .Nodes [0 ].AsClassDeclaration ().Members .Nodes [0 ]
562
564
name1 := ec .NewGeneratedNameForNode (n , printer.AutoGenerateOptions {})
@@ -573,7 +575,7 @@ func TestGeneratedNameForMethod2(t *testing.T) {
573
575
ec := printer .NewEmitContext ()
574
576
575
577
file := parsetestutil .ParseTypeScript ("class C { 0() {} }" , false /*jsx*/ )
576
- binder .BindSourceFile (file , & core. CompilerOptions {} )
578
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
577
579
578
580
n := file .Statements .Nodes [0 ].AsClassDeclaration ().Members .Nodes [0 ]
579
581
name1 := ec .NewGeneratedNameForNode (n , printer.AutoGenerateOptions {})
@@ -590,7 +592,7 @@ func TestGeneratedPrivateNameForMethod(t *testing.T) {
590
592
ec := printer .NewEmitContext ()
591
593
592
594
file := parsetestutil .ParseTypeScript ("class C { m() {} }" , false /*jsx*/ )
593
- binder .BindSourceFile (file , & core. CompilerOptions {} )
595
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
594
596
595
597
n := file .Statements .Nodes [0 ].AsClassDeclaration ().Members .Nodes [0 ]
596
598
name1 := ec .NewGeneratedPrivateNameForNode (n , printer.AutoGenerateOptions {})
@@ -607,7 +609,7 @@ func TestGeneratedNameForComputedPropertyName(t *testing.T) {
607
609
ec := printer .NewEmitContext ()
608
610
609
611
file := parsetestutil .ParseTypeScript ("class C { [x] }" , false /*jsx*/ )
610
- binder .BindSourceFile (file , & core. CompilerOptions {} )
612
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
611
613
612
614
n := file .Statements .Nodes [0 ].AsClassDeclaration ().Members .Nodes [0 ].Name ()
613
615
name1 := ec .NewGeneratedNameForNode (n , printer.AutoGenerateOptions {})
@@ -624,7 +626,7 @@ func TestGeneratedNameForOther(t *testing.T) {
624
626
ec := printer .NewEmitContext ()
625
627
626
628
file := parsetestutil .ParseTypeScript ("class C { [x] }" , false /*jsx*/ )
627
- binder .BindSourceFile (file , & core. CompilerOptions {} )
629
+ binder .BindSourceFile (file , defaultSourceFileAffectingOptions )
628
630
629
631
n := ec .Factory .NewObjectLiteralExpression (
630
632
ec .Factory .NewNodeList ([]* ast.Node {}),
0 commit comments