public HostCompilationStartAnalysisScope(HostSessionStartAnalysisScope sessionScope)
 {
     _sessionScope = sessionScope;
 }
 public AnalyzerAnalysisContext(DiagnosticAnalyzer analyzer, HostSessionStartAnalysisScope scope)
 {
     _analyzer = analyzer;
     _scope    = scope;
 }
Example #3
0
 /// <summary>
 /// Executes the <see cref="DiagnosticAnalyzer.Initialize(AnalysisContext)"/> for the given analyzer.
 /// </summary>
 /// <param name="analyzer">Analyzer to get session wide analyzer actions.</param>
 /// <param name="sessionScope">Session scope to store register session wide analyzer actions.</param>
 /// <remarks>
 /// Note that this API doesn't execute any <see cref="CompilationStartAnalyzerAction"/> registered by the Initialize invocation.
 /// Use <see cref="ExecuteCompilationStartActions(ImmutableArray{CompilationStartAnalyzerAction}, HostCompilationStartAnalysisScope)"/> API
 /// to get execute these actions to get the per-compilation analyzer actions.
 /// </remarks>
 public void ExecuteInitializeMethod(DiagnosticAnalyzer analyzer, HostSessionStartAnalysisScope sessionScope)
 {
     // The Initialize method should be run asynchronously in case it is not well behaved, e.g. does not terminate.
     ExecuteAndCatchIfThrows(analyzer, () => analyzer.Initialize(new AnalyzerAnalysisContext(analyzer, sessionScope)));
 }
Example #4
0
 public AnalyzerAnalysisContext(DiagnosticAnalyzer analyzer, HostSessionStartAnalysisScope scope, bool isIOperationFeatureEnabled = false)
 {
     _analyzer = analyzer;
     _scope    = scope;
     _isIOperationFeatureEnabled = isIOperationFeatureEnabled;
 }
Example #5
0
        /// <summary>
        /// Returns <see cref="GeneratedCodeAnalysisFlags"/> for the given analyzer.
        /// If an analyzer hasn't configured generated code analysis, returns <see cref="AnalyzerDriver.DefaultGeneratedCodeAnalysisFlags"/>.
        /// </summary>
        public async Task <GeneratedCodeAnalysisFlags> GetGeneratedCodeAnalysisFlagsAsync(DiagnosticAnalyzer analyzer, AnalyzerExecutor analyzerExecutor)
        {
            HostSessionStartAnalysisScope sessionScope = await GetSessionAnalysisScopeAsync(analyzer, analyzerExecutor).ConfigureAwait(false);

            return(sessionScope.GetGeneratedCodeAnalysisFlags(analyzer));
        }
Example #6
0
        /// <summary>
        /// Returns true if the given analyzer has enabled concurrent execution by invoking <see cref="AnalysisContext.EnableConcurrentExecution"/>.
        /// </summary>
        public async Task <bool> IsConcurrentAnalyzerAsync(DiagnosticAnalyzer analyzer, AnalyzerExecutor analyzerExecutor)
        {
            HostSessionStartAnalysisScope sessionScope = await GetSessionAnalysisScopeAsync(analyzer, analyzerExecutor).ConfigureAwait(false);

            return(sessionScope.IsConcurrentAnalyzer(analyzer));
        }