提交 33c6af15 编写于 作者: C Cyrus Najmabadi

Make more code async.

上级 4941c8a4
......@@ -266,4 +266,4 @@ public async Task TestAlreadyAutoPropertyWithGetterAndSetterWithNoBody()
await TestMissingAsync(@"class Class { public int [|P|] { get; set; } }");
}
}
}
}
\ No newline at end of file
......@@ -95,7 +95,7 @@ public void Apply(Workspace workspace, Document fromDocument, IEnumerable<CodeAc
{
foreach (var document in project.Documents)
{
if (!document.HasAnyErrors(cancellationToken).WaitAndGetResult(cancellationToken))
if (!document.HasAnyErrorsAsync(cancellationToken).WaitAndGetResult(cancellationToken))
{
documentErrorLookup.Add(document.Id);
}
......
......@@ -458,7 +458,7 @@ private bool CleanupWholeNode(TextSpan nodeSpan, IEnumerable<TextSpan> spans)
IEnumerable<TextSpan> spans = null;
#if DEBUG
bool originalDocHasErrors = await annotatedDocument.HasAnyErrors(cancellationToken).ConfigureAwait(false);
bool originalDocHasErrors = await annotatedDocument.HasAnyErrorsAsync(cancellationToken).ConfigureAwait(false);
#endif
var current = 0;
......
......@@ -228,7 +228,7 @@ public async Task<ConflictResolution> ResolveConflictsAsync()
}
}
#if DEBUG
DebugVerifyNoErrors(conflictResolution, _documentsIdsToBeCheckedForConflict);
await DebugVerifyNoErrorsAsync(conflictResolution, _documentsIdsToBeCheckedForConflict).ConfigureAwait(false);
#endif
return conflictResolution;
}
......@@ -239,7 +239,7 @@ public async Task<ConflictResolution> ResolveConflictsAsync()
}
#if DEBUG
private void DebugVerifyNoErrors(ConflictResolution conflictResolution, IEnumerable<DocumentId> documents)
private async Task DebugVerifyNoErrorsAsync(ConflictResolution conflictResolution, IEnumerable<DocumentId> documents)
{
var documentIdErrorStateLookup = new Dictionary<DocumentId, bool>();
......@@ -249,7 +249,7 @@ private void DebugVerifyNoErrors(ConflictResolution conflictResolution, IEnumera
{
// remember if there were issues in the document prior to renaming it.
var originalDoc = conflictResolution.OldSolution.GetDocument(documentId);
documentIdErrorStateLookup.Add(documentId, originalDoc.HasAnyErrors(_cancellationToken).WaitAndGetResult(_cancellationToken));
documentIdErrorStateLookup.Add(documentId, await originalDoc.HasAnyErrorsAsync(_cancellationToken).ConfigureAwait(false));
}
// We want to ignore few error message introduced by rename because the user is wantedly doing it.
......@@ -268,7 +268,7 @@ private void DebugVerifyNoErrors(ConflictResolution conflictResolution, IEnumera
// errors.
if (!documentIdErrorStateLookup[documentId] && _hasConflictCallback == null)
{
conflictResolution.NewSolution.GetDocument(documentId).VerifyNoErrorsAsync("Rename introduced errors in error-free code", _cancellationToken, ignoreErrorCodes).Wait(_cancellationToken);
await conflictResolution.NewSolution.GetDocument(documentId).VerifyNoErrorsAsync("Rename introduced errors in error-free code", _cancellationToken, ignoreErrorCodes).ConfigureAwait(false);
}
}
}
......
......@@ -105,7 +105,7 @@ public static Task<SemanticModel> GetSemanticModelForNodeAsync(this Document doc
}
#if DEBUG
public static async Task<bool> HasAnyErrors(this Document document, CancellationToken cancellationToken, List<string> ignoreErrorCode = null)
public static async Task<bool> HasAnyErrorsAsync(this Document document, CancellationToken cancellationToken, List<string> ignoreErrorCode = null)
{
if (!document.SupportsSemanticModel)
{
......@@ -122,7 +122,7 @@ public static async Task<bool> HasAnyErrors(this Document document, Cancellation
/// </summary>
public static async Task VerifyNoErrorsAsync(this Document newDocument, string message, CancellationToken cancellationToken, List<string> ignoreErrorCodes = null)
{
bool newDocumentHasErrors = await newDocument.HasAnyErrors(cancellationToken, ignoreErrorCodes).ConfigureAwait(false);
bool newDocumentHasErrors = await newDocument.HasAnyErrorsAsync(cancellationToken, ignoreErrorCodes).ConfigureAwait(false);
Debug.Assert(!newDocumentHasErrors, message);
}
#endif
......
......@@ -59,7 +59,7 @@ public async Task<Document> ReduceAsync(Document document, IEnumerable<TextSpan>
var root = semanticModel.SyntaxTree.GetRoot(cancellationToken);
#if DEBUG
bool originalDocHasErrors = await document.HasAnyErrors(cancellationToken).ConfigureAwait(false);
bool originalDocHasErrors = await document.HasAnyErrorsAsync(cancellationToken).ConfigureAwait(false);
#endif
var reduced = await this.ReduceAsyncInternal(document, spanList, optionSet, reducers, cancellationToken).ConfigureAwait(false);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册