Skip to content

Commit 85f0589

Browse files
Modernise style for file
1 parent 4d19fd8 commit 85f0589

1 file changed

Lines changed: 12 additions & 22 deletions

File tree

CodeConverter/Util/ISymbolExtensions.cs

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ public static ISymbol GetBaseSymbol(this ISymbol symbol, Func<ISymbol, bool> sel
1919
: symbol;
2020
}
2121

22-
public static bool IsDefinedInSource(this ISymbol symbol)
23-
{
24-
return symbol.Locations.Any(loc => loc.IsInSource);
25-
}
22+
public static bool IsDefinedInSource(this ISymbol symbol) => symbol.Locations.Any(loc => loc.IsInSource);
2623

2724
public static TSymbol? ExtractBestMatch<TSymbol>(this SymbolInfo info, Func<TSymbol, bool>? isMatch = null) where TSymbol : class, ISymbol
2825
{
@@ -69,31 +66,24 @@ private static bool TryGetSpecialVBTypeConversion(ISymbol symbol, out string? cS
6966
return false;
7067
}
7168

72-
public static bool IsPartialMethodImplementation(this ISymbol? declaredSymbol)
73-
{
74-
return declaredSymbol is IMethodSymbol {PartialDefinitionPart: not null};
75-
}
69+
public static bool IsPartialMethodImplementation(this ISymbol? declaredSymbol) =>
70+
declaredSymbol is IMethodSymbol {PartialDefinitionPart: not null};
7671

77-
public static bool CanHaveMethodBody(this ISymbol? declaredSymbol)
78-
{
79-
return declaredSymbol is IMethodSymbol ms && !ms.IsExtern && !IsPartialMethodDefinition(declaredSymbol);
80-
}
72+
public static bool CanHaveMethodBody(this ISymbol? declaredSymbol) =>
73+
declaredSymbol is IMethodSymbol {IsExtern: false} && !IsPartialMethodDefinition(declaredSymbol);
8174

82-
public static bool IsPartialMethodDefinition(this ISymbol? declaredSymbol)
83-
{
84-
return declaredSymbol is IMethodSymbol ms && (ms.PartialImplementationPart != null || ms.IsPartialDefinition);
85-
}
75+
public static bool IsPartialMethodDefinition(this ISymbol? declaredSymbol) =>
76+
declaredSymbol is IMethodSymbol {PartialImplementationPart: not null}
77+
or IMethodSymbol {IsPartialDefinition: true};
8678

8779
public static bool IsPartialClassDefinition(this ISymbol? declaredSymbol)
8880
{
89-
return declaredSymbol is ITypeSymbol ts && (ts.DeclaringSyntaxReferences.Length > 1
90-
|| ts.ContainingAssembly.Name == ForcePartialTypesAssemblyName);
81+
return declaredSymbol is ITypeSymbol {DeclaringSyntaxReferences.Length: > 1}
82+
or ITypeSymbol {ContainingAssembly.Name: ForcePartialTypesAssemblyName};
9183
}
9284

93-
public static bool IsReducedTypeParameterMethod(this ISymbol? symbol)
94-
{
95-
return symbol is IMethodSymbol ms && ms.ReducedFrom?.TypeParameters.Length > ms.TypeParameters.Length;
96-
}
85+
public static bool IsReducedTypeParameterMethod(this ISymbol? symbol) =>
86+
symbol is IMethodSymbol ms && ms.ReducedFrom?.TypeParameters.Length > ms.TypeParameters.Length;
9787

9888
/// <summary>
9989
/// Since non value types can't be ref types for extension methods in C#, convert to a static invocation

0 commit comments

Comments
 (0)