Skip to content

Commit 7d87d87

Browse files
committed
Minor code style tweaks
1 parent 2acbff6 commit 7d87d87

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

Microsoft.Toolkit.Mvvm.SourceGenerators/ComponentModel/ObservableValidatorValidateAllPropertiesGenerator.SyntaxReceiver.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ private sealed class SyntaxReceiver : ISyntaxContextReceiver
3232
public void OnVisitSyntaxNode(GeneratorSyntaxContext context)
3333
{
3434
if (context.Node is ClassDeclarationSyntax classDeclaration &&
35-
context.SemanticModel.GetDeclaredSymbol(classDeclaration) is INamedTypeSymbol classSymbol &&
36-
!classSymbol.IsGenericType &&
35+
context.SemanticModel.GetDeclaredSymbol(classDeclaration) is INamedTypeSymbol { IsGenericType: false } classSymbol &&
3736
context.SemanticModel.Compilation.GetTypeByMetadataName("Microsoft.Toolkit.Mvvm.ComponentModel.ObservableValidator") is INamedTypeSymbol validatorSymbol &&
3837
classSymbol.InheritsFrom(validatorSymbol))
3938
{

Microsoft.Toolkit.Mvvm.SourceGenerators/ComponentModel/TransitiveMembersGenerator.SyntaxReceiver.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ private sealed class SyntaxReceiver : ISyntaxContextReceiver
3131
/// <inheritdoc/>
3232
public void OnVisitSyntaxNode(GeneratorSyntaxContext context)
3333
{
34-
if (context.Node is ClassDeclarationSyntax classDeclaration &&
35-
classDeclaration.AttributeLists.Count > 0 &&
34+
if (context.Node is ClassDeclarationSyntax { AttributeLists: { Count: > 0 } } classDeclaration &&
3635
context.SemanticModel.GetDeclaredSymbol(classDeclaration) is INamedTypeSymbol classSymbol &&
3736
context.SemanticModel.Compilation.GetTypeByMetadataName(typeof(TAttribute).FullName) is INamedTypeSymbol attributeSymbol &&
3837
classSymbol.GetAttributes().FirstOrDefault(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, attributeSymbol)) is AttributeData attributeData &&

Microsoft.Toolkit.Mvvm.SourceGenerators/Messaging/IMessengerRegisterAllGenerator.SyntaxReceiver.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ private sealed class SyntaxReceiver : ISyntaxContextReceiver
3232
public void OnVisitSyntaxNode(GeneratorSyntaxContext context)
3333
{
3434
if (context.Node is ClassDeclarationSyntax classDeclaration &&
35-
context.SemanticModel.GetDeclaredSymbol(classDeclaration) is INamedTypeSymbol classSymbol &&
36-
!classSymbol.IsGenericType &&
35+
context.SemanticModel.GetDeclaredSymbol(classDeclaration) is INamedTypeSymbol { IsGenericType: false } classSymbol &&
3736
context.SemanticModel.Compilation.GetTypeByMetadataName("Microsoft.Toolkit.Mvvm.Messaging.IRecipient`1") is INamedTypeSymbol iRecipientSymbol &&
3837
classSymbol.AllInterfaces.Any(i => SymbolEqualityComparer.Default.Equals(i.OriginalDefinition, iRecipientSymbol)))
3938
{

0 commit comments

Comments
 (0)