private bool TryStartSyntaxAnalysis_NoLock(SyntaxTree tree, out AnalyzerStateData state)
            {
                if (_pendingSyntaxAnalysisTreesCount == 0)
                {
                    state = null;
                    return(false);
                }

                if (_lazySyntaxTreesWithAnalysisData.TryGetValue(tree, out state))
                {
                    if (state.StateKind != StateKind.ReadyToProcess)
                    {
                        state = null;
                        return(false);
                    }
                }
                else
                {
                    state = _analyzerStateDataPool.Allocate();
                }

                state.SetStateKind(StateKind.InProcess);
                Debug.Assert(state.StateKind == StateKind.InProcess);
                _lazySyntaxTreesWithAnalysisData[tree] = state;
                return(true);
            }
Esempio n. 2
0
            private static AnalyzerStateData CreateFullyProcessedInstance()
            {
                AnalyzerStateData instance = new AnalyzerStateData();

                instance.SetStateKind(StateKind.FullyProcessed);
                return(instance);
            }
 public bool TryStartSyntaxAnalysis(SyntaxTree tree, out AnalyzerStateData state)
 {
     lock (_gate)
     {
         Debug.Assert(_lazySyntaxTreesWithAnalysisData != null);
         return(TryStartSyntaxAnalysis_NoLock(tree, out state));
     }
 }
 public bool TryStartSyntaxAnalysis(SourceOrAdditionalFile tree, out AnalyzerStateData state)
 {
     lock (_gate)
     {
         Debug.Assert(_lazyFilesWithAnalysisData != null);
         return(TryStartSyntaxAnalysis_NoLock(tree, out state));
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Attempts to start processing a syntax tree for the given analyzer's syntax tree actions.
 /// </summary>
 /// <returns>
 /// Returns false if the tree has already been processed for the analyzer OR is currently being processed by another task.
 /// If true, then it returns a non-null <paramref name="state"/> representing partial syntax analysis state for the given tree for the given analyzer.
 /// </returns>
 public bool TryStartSyntaxAnalysis(SyntaxTree tree, DiagnosticAnalyzer analyzer, out AnalyzerStateData state)
 {
     return(GetAnalyzerState(analyzer).TryStartSyntaxAnalysis(tree, out state));
 }
Esempio n. 6
0
 /// <summary>
 /// Attempts to start processing a symbol for the given analyzer's symbol actions.
 /// </summary>
 /// <returns>
 /// Returns false if the symbol has already been processed for the analyzer OR is currently being processed by another task.
 /// If true, then it returns a non-null <paramref name="state"/> representing partial analysis state for the given symbol for the given analyzer.
 /// </returns>
 public bool TryStartAnalyzingSymbol(ISymbol symbol, DiagnosticAnalyzer analyzer, out AnalyzerStateData state)
 {
     return(GetAnalyzerState(analyzer).TryStartAnalyzingSymbol(symbol, out state));
 }
Esempio n. 7
0
 /// <summary>
 /// Attempts to start processing a compilation event for the given analyzer.
 /// </summary>
 /// <returns>
 /// Returns false if the event has already been processed for the analyzer OR is currently being processed by another task.
 /// If true, then it returns a non-null <paramref name="state"/> representing partial analysis state for the given event for the given analyzer.
 /// </returns>
 public bool TryStartProcessingEvent(CompilationEvent compilationEvent, DiagnosticAnalyzer analyzer, out AnalyzerStateData state)
 {
     return(GetAnalyzerState(analyzer).TryStartProcessingEvent(compilationEvent, out state));
 }
 public bool TryStartAnalyzingSymbol(ISymbol symbol, out AnalyzerStateData state)
 {
     return(TryStartProcessingEntity(symbol, _pendingSymbols, _analyzerStateDataPool, out state));
 }
 public bool TryStartProcessingEvent(CompilationEvent compilationEvent, out AnalyzerStateData state)
 {
     return(TryStartProcessingEntity(compilationEvent, _pendingEvents, _analyzerStateDataPool, out state));
 }
Esempio n. 10
0
 public bool TryStartSymbolEndAnalysis(ISymbol symbol, out AnalyzerStateData state)
 {
     return(TryStartProcessingEntity(symbol, _lazyPendingSymbolEndAnalyses, _analyzerStateDataPool, out state));
 }
Esempio n. 11
0
 /// <summary>
 /// Attempts to start processing a syntax tree for the given analyzer's syntax tree actions.
 /// </summary>
 /// <returns>
 /// Returns false if the tree has already been processed for the analyzer OR is currently being processed by another task.
 /// If true, then it returns a non-null <paramref name="state"/> representing partial syntax analysis state for the given tree for the given analyzer.
 /// </returns>
 public bool TryStartSyntaxAnalysis(SyntaxTree tree, DiagnosticAnalyzer analyzer, out AnalyzerStateData state)
 {
     return _analyzerStateMap[analyzer].TryStartSyntaxAnalysis(tree, out state);
 }
Esempio n. 12
0
 /// <summary>
 /// Attempts to start processing a symbol for the given analyzer's symbol actions.
 /// </summary>
 /// <returns>
 /// Returns false if the symbol has already been processed for the analyzer OR is currently being processed by another task.
 /// If true, then it returns a non-null <paramref name="state"/> representing partial analysis state for the given symbol for the given analyzer.
 /// </returns>
 public bool TryStartAnalyzingSymbol(ISymbol symbol, DiagnosticAnalyzer analyzer, out AnalyzerStateData state)
 {
     return _analyzerStateMap[analyzer].TryStartAnalyzingSymbol(symbol, out state);
 }
Esempio n. 13
0
 /// <summary>
 /// Attempts to start processing a compilation event for the given analyzer.
 /// </summary>
 /// <returns>
 /// Returns false if the event has already been processed for the analyzer OR is currently being processed by another task.
 /// If true, then it returns a non-null <paramref name="state"/> representing partial analysis state for the given event for the given analyzer.
 /// </returns>
 public bool TryStartProcessingEvent(CompilationEvent compilationEvent, DiagnosticAnalyzer analyzer, out AnalyzerStateData state)
 {
     return _analyzerStateMap[analyzer].TryStartProcessingEvent(compilationEvent, out state);
 }
 public bool TryStartSyntaxAnalysis(SyntaxTree tree, out AnalyzerStateData state)
 {
     Debug.Assert(_lazyPendingSyntaxAnalysisTrees != null);
     return(TryStartProcessingEntity(tree, _lazyPendingSyntaxAnalysisTrees, _analyzerStateDataPool, out state));
 }
Esempio n. 15
0
 /// <summary>
 /// Attempts to start processing a syntax tree or additional file for the given analyzer's syntax tree or additional file actions respectively.
 /// </summary>
 /// <returns>
 /// Returns false if the file has already been processed for the analyzer OR is currently being processed by another task.
 /// If true, then it returns a non-null <paramref name="state"/> representing partial syntax analysis state for the given tree for the given analyzer.
 /// </returns>
 public bool TryStartSyntaxAnalysis(SourceOrAdditionalFile file, DiagnosticAnalyzer analyzer, out AnalyzerStateData state)
 {
     return(GetAnalyzerState(analyzer).TryStartSyntaxAnalysis(file, out state));
 }
 private static AnalyzerStateData CreateFullyProcessedInstance()
 {
     var instance = new AnalyzerStateData();
     instance.SetStateKind(StateKind.FullyProcessed);
     return instance;
 }