Files
Just.Railway/Railway.SourceGenerator/ExtensionsMethodGenerator.cs
JustFixMe bb8c2135b5
All checks were successful
.NET Test / test (push) Successful in 1m7s
.NET Publish / publish (push) Successful in 1m16s
added Ensure extensions generator
2023-12-11 18:19:54 +04:00

33 lines
900 B
C#

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Text;
using Microsoft.CodeAnalysis;
namespace Just.Railway.SourceGen;
[Generator]
public class ExtensionsMethodGenerator : IIncrementalGenerator
{
private readonly IEnumerable<IGeneratorExecutor> _executors = new IGeneratorExecutor[]
{
new ResultCombineExecutor(),
new ResultMatchExecutor(),
new ResultMapExecutor(),
new ResultBindExecutor(),
new ResultTapExecutor(),
new ResultAppendExecutor(),
new TryExtensionsExecutor(),
new EnsureExtensionExecutor(),
};
public void Initialize(IncrementalGeneratorInitializationContext context)
{
foreach (var executor in _executors)
{
context.RegisterSourceOutput(context.CompilationProvider, executor.Execute);
}
}
}