private bool TryStartAnalyzingDeclaration_NoLock(ISymbol symbol, int declarationIndex, out DeclarationAnalyzerStateData state)
            {
                Dictionary <int, DeclarationAnalyzerStateData> declarationDataMap;

                if (!_pendingDeclarations.TryGetValue(symbol, out declarationDataMap))
                {
                    state = null;
                    return(false);
                }

                if (declarationDataMap.TryGetValue(declarationIndex, out state))
                {
                    if (state.StateKind != StateKind.ReadyToProcess)
                    {
                        state = null;
                        return(false);
                    }
                }
                else
                {
                    state = _declarationAnalyzerStateDataPool.Allocate();
                }

                state.SetStateKind(StateKind.InProcess);
                Debug.Assert(state.StateKind == StateKind.InProcess);
                declarationDataMap[declarationIndex] = state;
                return(true);
            }
Ejemplo n.º 2
0
 /// <summary>
 /// Attempts to start processing a symbol declaration for the given analyzer's syntax node and code block actions.
 /// </summary>
 /// <returns>
 /// Returns false if the declaration 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 declaration for the given analyzer.
 /// </returns>
 public bool TryStartAnalyzingDeclaration(SyntaxReference decl, DiagnosticAnalyzer analyzer, out DeclarationAnalyzerStateData state)
 {
     return _analyzerStateMap[analyzer].TryStartAnalyzingDeclaration(decl, out state);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Attempts to start processing a symbol declaration for the given analyzer's syntax node and code block actions.
 /// </summary>
 /// <returns>
 /// Returns false if the declaration 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 declaration for the given analyzer.
 /// </returns>
 public bool TryStartAnalyzingDeclaration(ISymbol symbol, int declarationIndex, DiagnosticAnalyzer analyzer, out DeclarationAnalyzerStateData state)
 {
     return(GetAnalyzerState(analyzer).TryStartAnalyzingDeclaration(symbol, declarationIndex, out state));
 }
 public bool TryStartAnalyzingDeclaration(ISymbol symbol, int declarationIndex, out DeclarationAnalyzerStateData state)
 {
     lock (_gate)
     {
         return(TryStartAnalyzingDeclaration_NoLock(symbol, declarationIndex, out state));
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Attempts to start processing a symbol declaration for the given analyzer's syntax node and code block actions.
 /// </summary>
 /// <returns>
 /// Returns false if the declaration 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 declaration for the given analyzer.
 /// </returns>
 public bool TryStartAnalyzingDeclaration(ISymbol symbol, int declarationIndex, DiagnosticAnalyzer analyzer, out DeclarationAnalyzerStateData state)
 {
     return GetAnalyzerState(analyzer).TryStartAnalyzingDeclaration(symbol, declarationIndex, out state);
 }
 public bool TryStartAnalyzingDeclaration(SyntaxReference decl, out DeclarationAnalyzerStateData state)
 {
     return(TryStartProcessingEntity(decl.GetSyntax(), _pendingDeclarations, _declarationAnalyzerStateDataPool, out state));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Attempts to start processing a symbol declaration for the given analyzer's syntax node and code block actions.
 /// </summary>
 /// <returns>
 /// Returns false if the declaration 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 declaration for the given analyzer.
 /// </returns>
 public bool TryStartAnalyzingDeclaration(SyntaxReference decl, DiagnosticAnalyzer analyzer, out DeclarationAnalyzerStateData state)
 {
     return(GetAnalyzerState(analyzer).TryStartAnalyzingDeclaration(decl, out state));
 }