Added parsing method for static buffer fields
このコミットが含まれているのは:
1 親
d6228da210
コミット
80fd4d96e0
3ファイル変更
+51
検索条件に一致するファイルはありません
@@ -88,6 +88,8 @@ namespace ComputeSharp.SourceGenerators
|
||||
{
|
||||
foreach (var fieldSymbol in structDeclarationSymbol.GetMembers().OfType<IFieldSymbol>())
|
||||
{
|
||||
if (fieldSymbol.IsStatic) continue;
|
||||
|
||||
INamedTypeSymbol typeSymbol = (INamedTypeSymbol)fieldSymbol.Type;
|
||||
|
||||
string typeName = HlslKnownTypes.GetMappedName(typeSymbol);
|
||||
@@ -106,6 +108,36 @@ namespace ComputeSharp.SourceGenerators
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a sequence of captured members and their mapped names.
|
||||
/// </summary>
|
||||
/// <param name="structDeclarationSymbol">The input <see cref="INamedTypeSymbol"/> instance to process.</param>
|
||||
/// <param name="types">The collection of currently discovered types.</param>
|
||||
/// <returns>A sequence of captured members in <paramref name="structDeclarationSymbol"/>.</returns>
|
||||
[Pure]
|
||||
private static IEnumerable<IEnumerable<string>> GetGroupSharedMembers(INamedTypeSymbol structDeclarationSymbol, ICollection<INamedTypeSymbol> types)
|
||||
{
|
||||
foreach (var fieldSymbol in structDeclarationSymbol.GetMembers().OfType<IFieldSymbol>())
|
||||
{
|
||||
if (!fieldSymbol.IsStatic) continue;
|
||||
|
||||
AttributeData attribute = fieldSymbol.GetAttributes().First(static a => a.AttributeClass is { Name: nameof(GroupSharedAttribute) });
|
||||
int? bufferSize = (int?)attribute.ConstructorArguments.FirstOrDefault().Value;
|
||||
IArrayTypeSymbol typeSymbol = (IArrayTypeSymbol)fieldSymbol.Type;
|
||||
|
||||
string typeName = HlslKnownTypes.GetMappedElementName(typeSymbol);
|
||||
|
||||
_ = HlslKnownKeywords.TryGetMappedName(fieldSymbol.Name, out string? mapping);
|
||||
|
||||
yield return new[]
|
||||
{
|
||||
mapping ?? fieldSymbol.Name,
|
||||
typeName,
|
||||
bufferSize?.ToString() ?? "-1"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a sequence of processed methods declared within a given type.
|
||||
/// </summary>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする