70 lines
3.8 KiB
C#
70 lines
3.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Immutable;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using Microsoft.CodeAnalysis.Diagnostics;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp;
|
|
|
|
public sealed class CSharpGeneratorDriver : GeneratorDriver
|
|
{
|
|
internal override CommonMessageProvider MessageProvider => (CommonMessageProvider)(object)Microsoft.CodeAnalysis.CSharp.MessageProvider.Instance;
|
|
|
|
internal override string SourceExtension => ".cs";
|
|
|
|
internal override ISyntaxHelper SyntaxHelper => CSharpSyntaxHelper.Instance;
|
|
|
|
internal CSharpGeneratorDriver(CSharpParseOptions parseOptions, ImmutableArray<ISourceGenerator> generators, AnalyzerConfigOptionsProvider optionsProvider, ImmutableArray<AdditionalText> additionalTexts, GeneratorDriverOptions driverOptions)
|
|
: base((ParseOptions)(object)parseOptions, generators, optionsProvider, additionalTexts, driverOptions)
|
|
{
|
|
}//IL_0006: Unknown result type (might be due to invalid IL or missing references)
|
|
|
|
|
|
private CSharpGeneratorDriver(GeneratorDriverState state)
|
|
: base(state)
|
|
{
|
|
}//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
|
|
|
|
public static CSharpGeneratorDriver Create(params ISourceGenerator[] generators)
|
|
{
|
|
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
|
|
return Create((IEnumerable<ISourceGenerator>)generators, (IEnumerable<AdditionalText>?)null, (CSharpParseOptions?)null, (AnalyzerConfigOptionsProvider?)null, default(GeneratorDriverOptions));
|
|
}
|
|
|
|
public static CSharpGeneratorDriver Create(params IIncrementalGenerator[] incrementalGenerators)
|
|
{
|
|
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
|
|
return Create(((IEnumerable<IIncrementalGenerator>)incrementalGenerators).Select((Func<IIncrementalGenerator, ISourceGenerator>)GeneratorExtensions.AsSourceGenerator));
|
|
}
|
|
|
|
public static CSharpGeneratorDriver Create(IEnumerable<ISourceGenerator> generators, IEnumerable<AdditionalText>? additionalTexts = null, CSharpParseOptions? parseOptions = null, AnalyzerConfigOptionsProvider? optionsProvider = null, GeneratorDriverOptions driverOptions = default(GeneratorDriverOptions))
|
|
{
|
|
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
|
|
return new CSharpGeneratorDriver(parseOptions ?? CSharpParseOptions.Default, generators.ToImmutableArray(), (AnalyzerConfigOptionsProvider)(((object)optionsProvider) ?? ((object)CompilerAnalyzerConfigOptionsProvider.Empty)), ImmutableArrayExtensions.AsImmutableOrEmpty<AdditionalText>(additionalTexts), driverOptions);
|
|
}
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
public static CSharpGeneratorDriver Create(IEnumerable<ISourceGenerator> generators, IEnumerable<AdditionalText>? additionalTexts, CSharpParseOptions? parseOptions, AnalyzerConfigOptionsProvider? optionsProvider)
|
|
{
|
|
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
|
|
return Create(generators, additionalTexts, parseOptions, optionsProvider, default(GeneratorDriverOptions));
|
|
}
|
|
|
|
internal override SyntaxTree ParseGeneratedSourceText(GeneratedSourceText input, string fileName, CancellationToken cancellationToken)
|
|
{
|
|
return CSharpSyntaxTree.ParseTextLazy(((GeneratedSourceText)(ref input)).Text, (CSharpParseOptions)(object)base._state.ParseOptions, fileName);
|
|
}
|
|
|
|
internal override GeneratorDriver FromState(GeneratorDriverState state)
|
|
{
|
|
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
|
|
return (GeneratorDriver)(object)new CSharpGeneratorDriver(state);
|
|
}
|
|
}
|