@@ -6,74 +6,34 @@ internal class DataContainerFactory : IDataContainerFactory
66{
77 private static readonly Dictionary < string , string > GenericTypeMap = new ( )
88 {
9- {
10- "List" , "List"
11- } ,
12- {
13- "IEnumerable" , "List"
14- } ,
15- {
16- "IReadOnlyCollection" , "List"
17- } ,
18- {
19- "IReadOnlyList" , "List"
20- } ,
21- {
22- "ICollection" , "List"
23- } ,
24- {
25- "IList" , "List"
26- } ,
27- {
28- "HashSet" , "HashSet"
29- } ,
30- {
31- "ISet" , "HashSet"
32- } ,
33- {
34- "Queue" , "Queue"
35- } ,
36- {
37- "Stack" , "Stack"
38- }
9+ { "List" , "List" } ,
10+ { "IEnumerable" , "List" } ,
11+ { "IReadOnlyCollection" , "List" } ,
12+ { "IReadOnlyList" , "List" } ,
13+ { "ICollection" , "List" } ,
14+ { "IList" , "List" } ,
15+ { "HashSet" , "HashSet" } ,
16+ { "ISet" , "HashSet" } ,
17+ { "Queue" , "Queue" } ,
18+ { "Stack" , "Stack" }
3919 } ;
4020
4121 private static readonly Dictionary < string , string > ReadonlyTypeMap = new ( )
4222 {
43- {
44- "IReadOnlyCollection" , "List"
45- } ,
46- {
47- "IReadOnlyList" , "List"
48- } ,
49- {
50- "IReadOnlySet" , "List"
51- }
23+ { "IReadOnlyCollection" , "List" } ,
24+ { "IReadOnlyList" , "List" } ,
25+ { "IReadOnlySet" , "List" }
5226 } ;
5327
5428 private static readonly Dictionary < string , string > ImmutableTypeMap = new ( )
5529 {
56- {
57- "ImmutableList" , "ImmutableList"
58- } ,
59- {
60- "IImmutableList" , "ImmutableList"
61- } ,
62- {
63- "ImmutableArray" , "ImmutableArray"
64- } ,
65- {
66- "ImmutableQueue" , "ImmutableQueue"
67- } ,
68- {
69- "IImmutableQueue" , "ImmutableQueue"
70- } ,
71- {
72- "ImmutableStack" , "ImmutableStack"
73- } ,
74- {
75- "IImmutableStack" , "ImmutableStack"
76- }
30+ { "ImmutableList" , "ImmutableList" } ,
31+ { "IImmutableList" , "ImmutableList" } ,
32+ { "ImmutableArray" , "ImmutableArray" } ,
33+ { "ImmutableQueue" , "ImmutableQueue" } ,
34+ { "IImmutableQueue" , "ImmutableQueue" } ,
35+ { "ImmutableStack" , "ImmutableStack" } ,
36+ { "IImmutableStack" , "ImmutableStack" }
7737 } ;
7838
7939 public bool TryCreate ( GenericNameSyntax genericNameSyntax , ref ExpressionSyntax ? expressionSyntax , ref ParameterSyntax argumentParameter )
@@ -111,7 +71,7 @@ public bool TryCreate(GenericNameSyntax genericNameSyntax, ref ExpressionSyntax?
11171 if ( ImmutableTypeMap . TryGetValue ( genericNameSyntax . Identifier . Text , out var immutableTypeName ) )
11272 {
11373 var immutableDataTypeName = SyntaxFactory . IdentifierName ( SyntaxFactory . Identifier ( $ "System.Collections.Immutable.{ immutableTypeName } ") ) ;
114- if ( expressionSyntax != default )
74+ if ( expressionSyntax != null )
11575 {
11676 expressionSyntax = SyntaxFactory . InvocationExpression (
11777 SyntaxFactory . MemberAccessExpression (
@@ -142,7 +102,7 @@ private static ExpressionSyntax CreateGenericContainer(ExpressionSyntax? express
142102 . AddTypeArgumentListArguments ( elementType ) ;
143103
144104 var result = SyntaxRepo . ObjectCreationExpression ( genericDataType ) ;
145- return expressionSyntax != default
105+ return expressionSyntax != null
146106 ? result . AddArgumentListArguments ( SyntaxFactory . Argument ( expressionSyntax ) )
147107 : result . AddArgumentListArguments ( ) ;
148108 }
0 commit comments