private static ImmutableDictionary <DiagnosticAnalyzer, ImmutableArray <ActionType> > GetBlockActionsByAnalyzer <ActionType>(
                ref ImmutableDictionary <DiagnosticAnalyzer, ImmutableArray <ActionType> > lazyCodeBlockActionsByAnalyzer,
                Func <AnalyzerActions, ImmutableArray <ActionType> > codeBlockActionsFactory,
                AnalyzerActions analyzerActions)
                where ActionType : AnalyzerAction
            {
                if (lazyCodeBlockActionsByAnalyzer == null)
                {
                    var codeBlockActionsByAnalyzer = CreateBlockActionsByAnalyzer(codeBlockActionsFactory, analyzerActions);
                    Interlocked.CompareExchange(ref lazyCodeBlockActionsByAnalyzer, codeBlockActionsByAnalyzer, null);
                }

                return(lazyCodeBlockActionsByAnalyzer);
            }
示例#2
0
        public override AnalyzerActions GetAnalyzerActions(DiagnosticAnalyzer analyzer)
        {
            AnalyzerActions compilationActions = base.GetAnalyzerActions(analyzer);
            AnalyzerActions sessionActions     = _sessionScope.GetAnalyzerActions(analyzer);

            if (sessionActions.IsEmpty)
            {
                return(compilationActions);
            }

            if (compilationActions.IsEmpty)
            {
                return(sessionActions);
            }

            return(compilationActions.Append(sessionActions));
        }
 private GroupedAnalyzerActions(AnalyzerActions analyzerActions)
 {
     _analyzerActions = analyzerActions;
 }