Simplified generated file names

このコミットが含まれているのは:
Sergio Pedri committed 2021-07-08 19:21:42 +02:00
1 親 87b4d0ae27
コミット dae3024cae
6ファイル変更
+11 -21

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

+1 -1
ファイルの表示
@@ -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));
}
}
}
+6 -16
ファイルの表示
@@ -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]_[&lt;TGENERATOR&gt;]_[&lt;SYMBOL_FULLNAME&gt;]"</returns>
/// <returns>A filename in the form "&lt;SYMBOL_FULLNAME&gt;"</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]_[&lt;TGENERATOR&gt;]_[&lt;SYMBOL_FULLNAME&gt;]"</returns>
/// <returns>A filename in the form "&lt;SYMBOL_FULLNAME&gt;"</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>
+1 -1
ファイルの表示
@@ -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>
+1 -1
ファイルの表示
@@ -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>
+1 -1
ファイルの表示
@@ -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>
+1 -1
ファイルの表示
@@ -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>