source gen and ir gen now use the same seq generator

This commit is contained in:
Youmu Liu
2026-07-10 18:49:57 +08:00
parent ef94bf1567
commit ae8a09efc2
2 changed files with 54 additions and 15 deletions
@@ -18,6 +18,28 @@ using System.Threading.Tasks;
namespace StgSharp.RegularAnalysis.Abstraction
{
public static class SequenceEmitterExtensions
{
public static SequenceEmitter<string> AppendLine(
this SequenceEmitter<string> emitter
)
{
return emitter is null ? null! : emitter.Append(string.Empty);
}
public static SequenceEmitter<string> AppendLine(
this SequenceEmitter<string> emitter,
string line
)
{
return emitter is null ?
null! :
emitter.Append(string.IsNullOrEmpty(line) ? string.Empty : line);
}
}
public sealed class SequenceEmitter<T>
{
@@ -35,6 +57,8 @@ namespace StgSharp.RegularAnalysis.Abstraction
public int Count { get; private set; }
private static bool IsString { get; } = typeof(T) == typeof(string);
public SequenceEmitter<T> Append(
T unit
)