Simplified generated file names
このコミットが含まれているのは:
1 親
87b4d0ae27
コミット
dae3024cae
6ファイル変更
+11
-21
検索条件に一致するファイルはありません
@@ -105,7 +105,7 @@ namespace ComputeSharp.SourceGenerators
|
||||
.ToFullString();
|
||||
|
||||
// Add the partial type
|
||||
context.AddSource(structDeclarationSymbol.GetGeneratedFileName<AutoConstructorGenerator>(), SourceText.From(source, Encoding.UTF8));
|
||||
context.AddSource(structDeclarationSymbol.GetGeneratedFileName(), SourceText.From(source, Encoding.UTF8));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,33 +108,23 @@ namespace ComputeSharp.SourceGenerators.Extensions
|
||||
/// <summary>
|
||||
/// Gets a valid filename for a target symbol and generator type.
|
||||
/// </summary>
|
||||
/// <typeparam name="TGenerator">The generator type processing the input symbol.</typeparam>
|
||||
/// <param name="symbol">The symbol being processed.</param>
|
||||
/// <returns>A filename in the form "[ComputeSharp]_[<TGENERATOR>]_[<SYMBOL_FULLNAME>]"</returns>
|
||||
/// <returns>A filename in the form "<SYMBOL_FULLNAME>"</returns>
|
||||
[Pure]
|
||||
public static string GetGeneratedFileName<TGenerator>(this INamedTypeSymbol symbol)
|
||||
public static string GetGeneratedFileName(this INamedTypeSymbol symbol)
|
||||
{
|
||||
string
|
||||
metadataName = symbol.GetFullMetadataName(),
|
||||
fixedName = metadataName.Replace('`', '-').Replace('+', '.');
|
||||
|
||||
return $"[{nameof(ComputeSharp)}]_[{typeof(TGenerator).Name}]_[{fixedName}]";
|
||||
return symbol.GetFullMetadataName().Replace('`', '-').Replace('+', '.');
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a valid filename for a target symbol and generator type.
|
||||
/// </summary>
|
||||
/// <typeparam name="TGenerator">The generator type processing the input symbol.</typeparam>
|
||||
/// <param name="symbol">The symbol being processed.</param>
|
||||
/// <returns>A filename in the form "[ComputeSharp]_[<TGENERATOR>]_[<SYMBOL_FULLNAME>]"</returns>
|
||||
/// <returns>A filename in the form "<SYMBOL_FULLNAME>"</returns>
|
||||
[Pure]
|
||||
public static string GetGeneratedFileName<TGenerator>(this IMethodSymbol symbol)
|
||||
public static string GetGeneratedFileName(this IMethodSymbol symbol)
|
||||
{
|
||||
string
|
||||
metadataName = symbol.GetFullMetadataName(true),
|
||||
fixedName = metadataName.Replace('`', '-').Replace('+', '.');
|
||||
|
||||
return $"[{nameof(ComputeSharp)}]_[{typeof(TGenerator).Name}]_[{fixedName}]";
|
||||
return symbol.GetFullMetadataName(true).Replace('`', '-').Replace('+', '.');
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace ComputeSharp.SourceGenerators
|
||||
attributes = Array.Empty<AttributeListSyntax>();
|
||||
|
||||
// Add the method source attribute
|
||||
context.AddSource(structDeclarationSymbol.GetGeneratedFileName<IComputeShaderDataLoaderGenerator>(), SourceText.From(source, Encoding.UTF8));
|
||||
context.AddSource(structDeclarationSymbol.GetGeneratedFileName(), SourceText.From(source, Encoding.UTF8));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace ComputeSharp.SourceGenerators
|
||||
attributes = Array.Empty<AttributeListSyntax>();
|
||||
|
||||
// Add the method source attribute
|
||||
context.AddSource(structDeclarationSymbol.GetGeneratedFileName<IComputeShaderHashCodeGenerator>(), SourceText.From(source, Encoding.UTF8));
|
||||
context.AddSource(structDeclarationSymbol.GetGeneratedFileName(), SourceText.From(source, Encoding.UTF8));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace ComputeSharp.SourceGenerators
|
||||
.ToFullString();
|
||||
|
||||
// Add the method source attribute
|
||||
context.AddSource(structDeclarationSymbol.GetGeneratedFileName<IComputeShaderSourceGenerator>(), SourceText.From(source, Encoding.UTF8));
|
||||
context.AddSource(structDeclarationSymbol.GetGeneratedFileName(), SourceText.From(source, Encoding.UTF8));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace ComputeSharp.SourceGenerators
|
||||
.ToFullString();
|
||||
|
||||
// Add the method source attribute
|
||||
context.AddSource(methodDeclarationSymbol.GetGeneratedFileName<ShaderMethodSourceAttribute>(), SourceText.From(source, Encoding.UTF8));
|
||||
context.AddSource(methodDeclarationSymbol.GetGeneratedFileName(), SourceText.From(source, Encoding.UTF8));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする