Example #1
0
        /// <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;
        }
Example #2
0
 /// <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)));
 }
Example #3
0
 /// <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));
 }
Example #4
0
 /// <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));
 }
Example #5
0
 /// <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));
 }
Example #6
0
 /// <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));
 }
Example #7
0
 /// <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));
 }
Example #8
0
 /// <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));
 }
Example #9
0
 /// <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));
 }
Example #10
0
 /// <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));
 }
Example #11
0
 /// <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));
 }
Example #12
0
 /// <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));
 }
Example #13
0
 /// <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)));
 }
Example #14
0
 /// <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));
 }