/// <inheritdoc/> public sealed override void Initialize(AnalysisContext context) { if (Concurrent) { context.EnableConcurrentExecution(); } context.ConfigureGeneratedCodeAnalysis(AllowGenerated ? GeneratedCodeAnalysisFlags.Analyze : GeneratedCodeAnalysisFlags.None); context.RegisterCompilationStartAction(context => { if (context.Compilation is not CSharpCompilation compilation) { return; } DiagnosticBag diagnosticReceiver = DiagnosticReceiverFactory.Bag(); TCompilation data = CreateCompilation(compilation, diagnosticReceiver); IDurianAnalysisContext durianContext = new DurianCompilationStartAnalysisContext(context); if (!data.HasErrors) { Register(durianContext, data); } ReportInitializationDiagnostics(durianContext, diagnosticReceiver); }); }
private protected sealed override void Register(IDurianAnalysisContext context, CSharpCompilation compilation) { DiagnosticBag diagnosticReceiver = DiagnosticReceiverFactory.Bag(); TCompilation data = CreateCompilation(compilation, diagnosticReceiver); if (!data.HasErrors) { Register(context, data); } ReportInitializationDiagnostics(context, diagnosticReceiver); }