提交 8840fbb6 编写于 作者: M Manish Vasani

Address PR feedback from Aleksey

上级 e0c79807
......@@ -1709,7 +1709,7 @@ private void CompleteTree(SyntaxTree tree)
if (_lazyCompilationUnitCompletedTrees.Count == this.SyntaxTrees.Length)
{
// if that was the last tree, signal the end of compilation
EnsureCompilationCompleted();
CompleteCompilationEventQueue_NoLock();
}
}
}
......@@ -1949,9 +1949,9 @@ internal ImmutableArray<Diagnostic> GetDiagnostics(CompilationStage stage, bool
builder.AddRange(GetSourceDeclarationDiagnostics(cancellationToken: cancellationToken));
if (this.EventQueue != null && this.SyntaxTrees.Length == 0)
if (EventQueue != null && SyntaxTrees.Length == 0)
{
EnsureCompilationCompleted();
EnsureCompilationEventQueueCompleted();
}
}
......
......@@ -851,22 +851,29 @@ public INamedTypeSymbol GetTypeByMetadataName(string fullyQualifiedMetadataName)
/// </summary>
public abstract ImmutableArray<Diagnostic> GetDiagnostics(CancellationToken cancellationToken = default(CancellationToken));
internal void EnsureCompilationCompleted()
internal void EnsureCompilationEventQueueCompleted()
{
Debug.Assert(this.EventQueue != null);
Debug.Assert(EventQueue != null);
lock (this.EventQueue)
lock (EventQueue)
{
if (!this.EventQueue.IsCompleted)
if (!EventQueue.IsCompleted)
{
// Signal the end of compilation.
EventQueue.TryEnqueue(new CompilationCompletedEvent(this));
EventQueue.PromiseNotToEnqueue();
EventQueue.TryComplete();
CompleteCompilationEventQueue_NoLock();
}
}
}
internal void CompleteCompilationEventQueue_NoLock()
{
Debug.Assert(EventQueue != null);
// Signal the end of compilation.
EventQueue.TryEnqueue(new CompilationCompletedEvent(this));
EventQueue.PromiseNotToEnqueue();
EventQueue.TryComplete();
}
internal abstract CommonMessageProvider MessageProvider { get; }
/// <param name="accumulator">Bag to which filtered diagnostics will be added.</param>
......
......@@ -1644,7 +1644,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
If _lazyCompilationUnitCompletedTrees.Count = SyntaxTrees.Length Then
' if that was the last tree, signal the end of compilation
EnsureCompilationCompleted()
CompleteCompilationEventQueue_NoLock()
End If
End If
End SyncLock
......@@ -1924,8 +1924,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
builder.AddRange(SourceAssembly.GetAllDeclarationErrors(cancellationToken))
builder.AddRange(GetClsComplianceDiagnostics(cancellationToken))
If Me.EventQueue IsNot Nothing AndAlso Me.SyntaxTrees.Length = 0 Then
EnsureCompilationCompleted()
If EventQueue IsNot Nothing AndAlso SyntaxTrees.Length = 0 Then
EnsureCompilationEventQueueCompleted()
End If
End If
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册