added Try extensions generator
All checks were successful
.NET Test / test (push) Successful in 4m13s

This commit is contained in:
2023-12-08 17:54:17 +04:00
parent 036b34d3c0
commit 26a1c604d5
3 changed files with 214 additions and 105 deletions

View File

@@ -0,0 +1,31 @@
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(),
};
public void Initialize(IncrementalGeneratorInitializationContext context)
{
foreach (var executor in _executors)
{
context.RegisterSourceOutput(context.CompilationProvider, executor.Execute);
}
}
}