Add attributes to generated types and members

このコミットが含まれているのは:
Sergio Pedri committed 2023-09-30 01:34:04 +02:00
1 親 eba861e20e
コミット 648f6e5c33
13ファイル変更
+59 -12

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

+17
ファイルの表示
@@ -8,6 +8,23 @@ namespace ComputeSharp.SourceGeneration.Extensions;
/// </summary>
internal static class IndentedTextWriterExtensions
{
/// <summary>
/// Writes the following attributes into a target writer:
/// <code>
/// [global::System.CodeDom.Compiler.GeneratedCode("...", "...")]
/// [global::System.Diagnostics.DebuggerNonUserCode]
/// [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
/// </code>
/// </summary>
/// <param name="writer">The <see cref="IndentedTextWriter"/> instance to write into.</param>
/// <param name="generatorType">The type of the running generator.</param>
public static void WriteGeneratedAttributes(this IndentedTextWriter writer, Type generatorType)
{
writer.WriteLine($$"""[global::System.CodeDom.Compiler.GeneratedCode("{{generatorType.FullName}}", "{{generatorType.Assembly.GetName().Version}}")]""");
writer.WriteLine($$"""[global::System.Diagnostics.DebuggerNonUserCode]""");
writer.WriteLine($$"""[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]""");
}
/// <summary>
/// Writes a series of members separated by one line between each of them.
/// </summary>