Пример #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;
        }
Пример #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)));
 }
Пример #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));
 }
Пример #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));
 }
Пример #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));
 }
Пример #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));
 }
Пример #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));
 }
Пример #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));
 }
Пример #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));
 }
Пример #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));
 }
Пример #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));
 }
Пример #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));
 }
Пример #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)));
 }
Пример #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));
 }