/// <summary> /// Initializes a new instance of the <see cref="LoggableSourceGenerator"/> class. /// </summary> /// <param name="generator"><see cref="LoggableSourceGenerator"/> that will log the received <see cref="Diagnostic"/>s.</param> public LoggableGeneratorDiagnosticReceiver(LoggableSourceGenerator generator) { if (generator is null) { throw new ArgumentNullException(nameof(generator)); } _bag = new(); Generator = generator; }
/// <summary> /// Creates a new instance of the <see cref="ContextualLoggableGeneratorDiagnosticReceiver{T}"/> class that accepts only <see cref="CompilationAnalysisContext"/>. /// </summary> /// <param name="generator">Target <see cref="LoggableSourceGenerator"/>.</param> public static ContextualLoggableGeneratorDiagnosticReceiver <CompilationAnalysisContext> Compilation(LoggableSourceGenerator generator) { return(new ContextualLoggableGeneratorDiagnosticReceiver <CompilationAnalysisContext>(generator, (context, diag) => context.ReportDiagnostic(diag))); }
/// <summary> /// Creates a new instance of the <see cref="ContextualLoggableGeneratorDiagnosticReceiver{T}"/> class that accepts only <see cref="CompilationAnalysisContext"/>. /// </summary> /// <param name="generator">Target <see cref="LoggableSourceGenerator"/>.</param> /// <param name="diagnosticReceiver">Target <see cref="ContextualDiagnosticReceiver{T}"/>.</param> public static ContextualLoggableGeneratorDiagnosticReceiver <CompilationAnalysisContext> Compilation(LoggableSourceGenerator generator, ContextualDiagnosticReceiver <CompilationAnalysisContext> diagnosticReceiver) { return(new ContextualLoggableGeneratorDiagnosticReceiver <CompilationAnalysisContext>(generator, diagnosticReceiver)); }
/// <summary> /// Creates a new instance of the <see cref="LoggableGeneratorDiagnosticReceiver"/> class. /// </summary> /// <param name="generator">Target <see cref="LoggableSourceGenerator"/>.</param> public static LoggableGeneratorDiagnosticReceiver Basic(LoggableSourceGenerator generator) { return(new LoggableGeneratorDiagnosticReceiver(generator)); }
/// <summary> /// Creates a new instance of the <see cref="ContextualLoggableGeneratorDiagnosticReceiver{T}"/> class that accepts only <see cref="CodeBlockAnalysisContext"/>. /// </summary> /// <param name="generator">Target <see cref="LoggableSourceGenerator"/>.</param> /// <param name="context">Context of this <see cref="ContextualLoggableGeneratorDiagnosticReceiver{T}"/>.</param> public static ContextualLoggableGeneratorDiagnosticReceiver <CodeBlockAnalysisContext> CodeBlock(LoggableSourceGenerator generator, CodeBlockAnalysisContext context) { return(new ContextualLoggableGeneratorDiagnosticReceiver <CodeBlockAnalysisContext>(generator, (context, diag) => context.ReportDiagnostic(diag), context)); }
/// <summary> /// Creates a new instance of the <see cref="ContextualLoggableGeneratorDiagnosticReceiver{T}"/> class that accepts only <see cref="SyntaxTreeAnalysisContext"/>. /// </summary> /// <param name="generator">Target <see cref="LoggableSourceGenerator"/>.</param> /// <param name="context">Context of this <see cref="ContextualLoggableGeneratorDiagnosticReceiver{T}"/>.</param> public static ContextualLoggableGeneratorDiagnosticReceiver <SyntaxTreeAnalysisContext> SyntaxTree(LoggableSourceGenerator generator, SyntaxTreeAnalysisContext context) { return(new ContextualLoggableGeneratorDiagnosticReceiver <SyntaxTreeAnalysisContext>(generator, (context, diag) => context.ReportDiagnostic(diag), context)); }
/// <summary> /// Creates a new instance of the <see cref="ReadonlyContextualLoggableGeneratorDiagnosticReceiver{T}"/> class that accepts only <see cref="AdditionalFileAnalysisContext"/>. /// </summary> /// <param name="generator">Target <see cref="LoggableSourceGenerator"/>.</param> /// <param name="context">Context of this <see cref="ReadonlyContextualLoggableGeneratorDiagnosticReceiver{T}"/>.</param> public static ReadonlyContextualLoggableGeneratorDiagnosticReceiver <AdditionalFileAnalysisContext> AdditionalFile(LoggableSourceGenerator generator, AdditionalFileAnalysisContext context) { return(new ReadonlyContextualLoggableGeneratorDiagnosticReceiver <AdditionalFileAnalysisContext>(generator, (in AdditionalFileAnalysisContext context, Diagnostic diag) => context.ReportDiagnostic(diag), context)); }
/// <summary> /// Creates a new instance of the <see cref="ReadonlyContextualLoggableGeneratorDiagnosticReceiver{T}"/> class that accepts only <see cref="AdditionalFileAnalysisContext"/>. /// </summary> /// <param name="generator">Target <see cref="LoggableSourceGenerator"/>.</param> /// <param name="diagnosticReceiver">Target <see cref="ReadonlyContextualDiagnosticReceiver{T}"/>.</param> public static ReadonlyContextualLoggableGeneratorDiagnosticReceiver <AdditionalFileAnalysisContext> AdditionalFile(LoggableSourceGenerator generator, ReadonlyContextualDiagnosticReceiver <AdditionalFileAnalysisContext> diagnosticReceiver) { return(new ReadonlyContextualLoggableGeneratorDiagnosticReceiver <AdditionalFileAnalysisContext>(generator, diagnosticReceiver)); }
/// <summary> /// Creates a new instance of the <see cref="ContextualLoggableGeneratorDiagnosticReceiver{T}"/> class that accepts only <see cref="SyntaxTreeAnalysisContext"/>. /// </summary> /// <param name="generator">Target <see cref="LoggableSourceGenerator"/>.</param> /// <param name="diagnosticReceiver">Target <see cref="ContextualDiagnosticReceiver{T}"/>.</param> public static ContextualLoggableGeneratorDiagnosticReceiver <SyntaxTreeAnalysisContext> SyntaxTree(LoggableSourceGenerator generator, ContextualDiagnosticReceiver <SyntaxTreeAnalysisContext> diagnosticReceiver) { return(new ContextualLoggableGeneratorDiagnosticReceiver <SyntaxTreeAnalysisContext>(generator, diagnosticReceiver)); }
/// <summary> /// Creates a new instance of the <see cref="ReadonlyContextualLoggableGeneratorDiagnosticReceiver{T}"/> class that accepts only <see cref="GeneratorExecutionContext"/>. /// </summary> /// <param name="generator">Target <see cref="LoggableSourceGenerator"/>.</param> /// <param name="context">Context of this <see cref="ReadonlyContextualLoggableGeneratorDiagnosticReceiver{T}"/>.</param> public static ReadonlyContextualLoggableGeneratorDiagnosticReceiver <GeneratorExecutionContext> SourceGenerator(LoggableSourceGenerator generator, GeneratorExecutionContext context) { return(new ReadonlyContextualLoggableGeneratorDiagnosticReceiver <GeneratorExecutionContext>(generator, (in GeneratorExecutionContext context, Diagnostic diag) => context.ReportDiagnostic(diag), context)); }
/// <summary> /// Creates a new instance of the <see cref="ReadonlyContextualLoggableGeneratorDiagnosticReceiver{T}"/> class that accepts only <see cref="GeneratorExecutionContext"/>. /// </summary> /// <param name="generator">Target <see cref="LoggableSourceGenerator"/>.</param> /// <param name="diagnosticReceiver">Target <see cref="ReadonlyContextualDiagnosticReceiver{T}"/>.</param> public static ReadonlyContextualLoggableGeneratorDiagnosticReceiver <GeneratorExecutionContext> SourceGenerator(LoggableSourceGenerator generator, ReadonlyContextualDiagnosticReceiver <GeneratorExecutionContext> diagnosticReceiver) { return(new ReadonlyContextualLoggableGeneratorDiagnosticReceiver <GeneratorExecutionContext>(generator, diagnosticReceiver)); }
/// <summary> /// Creates a new instance of the <see cref="ContextualLoggableGeneratorDiagnosticReceiver{T}"/> class that accepts only <see cref="SemanticModelAnalysisContext"/>. /// </summary> /// <param name="generator">Target <see cref="LoggableSourceGenerator"/>.</param> /// <param name="diagnosticReceiver">Target <see cref="ContextualDiagnosticReceiver{T}"/>.</param> public static ContextualLoggableGeneratorDiagnosticReceiver <SemanticModelAnalysisContext> SemanticModel(LoggableSourceGenerator generator, ContextualDiagnosticReceiver <SemanticModelAnalysisContext> diagnosticReceiver) { return(new ContextualLoggableGeneratorDiagnosticReceiver <SemanticModelAnalysisContext>(generator, diagnosticReceiver)); }
/// <summary> /// Creates a new instance of the <see cref="ContextualLoggableGeneratorDiagnosticReceiver{T}"/> class that accepts only <see cref="SemanticModelAnalysisContext"/>. /// </summary> /// <param name="generator">Target <see cref="LoggableSourceGenerator"/>.</param> public static ContextualLoggableGeneratorDiagnosticReceiver <SemanticModelAnalysisContext> SemanticModel(LoggableSourceGenerator generator) { return(new ContextualLoggableGeneratorDiagnosticReceiver <SemanticModelAnalysisContext>(generator, (context, diag) => context.ReportDiagnostic(diag))); }
/// <summary> /// Creates a new OperationBlockAnalysisContext of the <see cref="ContextualLoggableGeneratorDiagnosticReceiver{T}"/> class that accepts only <see cref="SymbolAnalysisContext"/>. /// </summary> /// <param name="generator">Target <see cref="LoggableSourceGenerator"/>.</param> /// <param name="diagnosticReceiver">Target <see cref="ContextualDiagnosticReceiver{T}"/>.</param> public static ContextualLoggableGeneratorDiagnosticReceiver <OperationBlockAnalysisContext> OperationBlock(LoggableSourceGenerator generator, ContextualDiagnosticReceiver <OperationBlockAnalysisContext> diagnosticReceiver) { return(new ContextualLoggableGeneratorDiagnosticReceiver <OperationBlockAnalysisContext>(generator, diagnosticReceiver)); }