@@ -169,20 +169,20 @@ internal class TargetTypeTracker : ISyntaxContextReceiver
169
169
170
170
public void OnVisitSyntaxNode ( GeneratorSyntaxContext context )
171
171
{
172
- if ( context . Node is ClassDeclarationSyntax cdecl )
173
- if ( cdecl . IsDecoratedWithAttribute ( "GenerateDataReaderMapper" ) )
174
- TypesNeedingGening = TypesNeedingGening . Add ( cdecl ) ;
172
+ if ( context . Node is not ClassDeclarationSyntax classDec ) return ;
173
+
174
+ if ( classDec . IsDecoratedWithAttribute ( "GenerateDataReaderMapper" ) )
175
+ TypesNeedingGening = TypesNeedingGening . Add ( classDec ) ;
175
176
}
176
177
}
177
178
178
179
internal static class Helpers
179
180
{
180
- internal static bool IsDecoratedWithAttribute ( this TypeDeclarationSyntax cdecl , string attributeName ) =>
181
- cdecl . AttributeLists
181
+ internal static bool IsDecoratedWithAttribute ( this TypeDeclarationSyntax typeDec , string attributeName ) =>
182
+ typeDec . AttributeLists
182
183
. SelectMany ( x => x . Attributes )
183
184
. Any ( x => x . Name . ToString ( ) . Contains ( attributeName ) ) ;
184
185
185
-
186
186
internal static string FullName ( this ITypeSymbol typeSymbol ) => typeSymbol . ToDisplayString ( SymbolDisplayFormat . FullyQualifiedFormat ) ;
187
187
188
188
internal static string StringConcat ( this IEnumerable < string > source , string separator ) => string . Join ( separator , source ) ;
@@ -214,12 +214,11 @@ internal static bool IsNullableEnum(this ITypeSymbol symbol)
214
214
//tries to get underlying non-nullable type from nullable type
215
215
//and then check if it's Enum
216
216
if ( symbol . NullableAnnotation == NullableAnnotation . Annotated
217
- && symbol is INamedTypeSymbol namedType
218
- && namedType . IsValueType
219
- && namedType . IsGenericType
220
- && namedType . ConstructedFrom ? . ToDisplayString ( ) == "System.Nullable<T>"
221
- )
217
+ && symbol is INamedTypeSymbol { IsValueType : true , IsGenericType : true } namedType
218
+ && namedType . ConstructedFrom . ToDisplayString ( ) == "System.Nullable<T>" )
219
+ {
222
220
return namedType . TypeArguments [ 0 ] . TypeKind == TypeKind . Enum ;
221
+ }
223
222
224
223
return false ;
225
224
}
0 commit comments