Code refactoring in IShaderGenerator

このコミットが含まれているのは:
Sergio Pedri committed 2021-12-08 11:17:06 +01:00
1 親 1262bf6e0e
コミット 0004353052
13ファイル変更
+1897 -1835

検索条件に一致するファイルはありません

+18 -12
ファイルの表示
@@ -9,19 +9,25 @@ namespace ComputeSharp.SourceGenerators;
public sealed partial class IShaderGenerator
{
/// <summary>
/// Extracts the names of all instance fields of a <see cref="System.Delegate"/> type.
/// A helper with all logic to generate the <c>GetDispatchId</c> method.
/// </summary>
/// <param name="structDeclarationSymbol">The input <see cref="INamedTypeSymbol"/> instance to process.</param>
/// <returns>The names of all <see cref="System.Delegate"/> instance fields within <paramref name="structDeclarationSymbol"/>.</returns>
[Pure]
private static ImmutableArray<string> GetDelegateFieldNames(INamedTypeSymbol structDeclarationSymbol)
private static partial class GetDispatchId
{
return
structDeclarationSymbol
.GetMembers()
.OfType<IFieldSymbol>()
.Where(static member => member.Type is INamedTypeSymbol { TypeKind: TypeKind.Delegate, IsStatic: false })
.Select(static member => member.Name)
.ToImmutableArray();
/// <summary>
/// Extracts the names of all instance fields of a <see cref="System.Delegate"/> type.
/// </summary>
/// <param name="structDeclarationSymbol">The input <see cref="INamedTypeSymbol"/> instance to process.</param>
/// <returns>The names of all <see cref="System.Delegate"/> instance fields within <paramref name="structDeclarationSymbol"/>.</returns>
[Pure]
public static ImmutableArray<string> GetInfo(INamedTypeSymbol structDeclarationSymbol)
{
return
structDeclarationSymbol
.GetMembers()
.OfType<IFieldSymbol>()
.Where(static member => member.Type is INamedTypeSymbol { TypeKind: TypeKind.Delegate, IsStatic: false })
.Select(static member => member.Name)
.ToImmutableArray();
}
}
}