Switch LoadDispatchData method to indented writer

このコミットが含まれているのは:
Sergio Pedri committed 2023-10-14 00:35:03 +02:00
1 親 6900923431
コミット d9eb477c1c
4ファイル変更
+115 -245

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

+32
ファイルの表示
@@ -1,4 +1,5 @@
using System;
using System.Runtime.CompilerServices;
using ComputeSharp.SourceGeneration.Helpers;
namespace ComputeSharp.SourceGeneration.Extensions;
@@ -52,6 +53,37 @@ internal static class IndentedTextWriterExtensions
}
}
/// <summary>
/// Writes a new line into the target writer depending on an input condition.
/// </summary>
/// <param name="writer">The <see cref="IndentedTextWriter"/> instance to write into.</param>
/// <param name="content">The content to write.</param>
/// <param name="condition">The condition to use to decide whether or not to write a new line.</param>
public static void WriteLineIf(this IndentedTextWriter writer, string content, bool condition)
{
if (condition)
{
writer.WriteLine(content);
}
}
/// <summary>
/// Writes a new line into the target writer depending on an input condition.
/// </summary>
/// <param name="writer">The <see cref="IndentedTextWriter"/> instance to write into.</param>
/// <param name="handler">The interpolated string handler with content to write.</param>
/// <param name="condition">The condition to use to decide whether or not to write a new line.</param>
public static void WriteLineIf(
this IndentedTextWriter writer,
[InterpolatedStringHandlerArgument(nameof(writer))] ref IndentedTextWriter.WriteInterpolatedStringHandler handler,
bool condition)
{
if (condition)
{
writer.WriteLine(ref handler);
}
}
/// <summary>
/// Writes a series of members separated by one line between each of them.
/// </summary>