-Refactored enum name writing

-Improved performance of reading and writing enum names
-Tests
This commit is contained in:
James Newton-King
2018-01-01 13:15:08 +13:00
parent 2244a82282
commit eb85ba3f7c
7 changed files with 454 additions and 47 deletions
+10 -10
View File
@@ -293,7 +293,7 @@ namespace Newtonsoft.Json
t = WriteNullAsync(cancellationToken);
if (!t.IsCompletedSucessfully())
{
return AwaitProperty(t, levelsToComplete, token, type, cancellationToken);
return AwaitProperty(t, levelsToComplete, token, cancellationToken);
}
}
@@ -304,7 +304,7 @@ namespace Newtonsoft.Json
t = WriteIndentAsync(cancellationToken);
if (!t.IsCompletedSucessfully())
{
return AwaitIndent(t, levelsToComplete, token, type, cancellationToken);
return AwaitIndent(t, levelsToComplete, token, cancellationToken);
}
}
}
@@ -312,7 +312,7 @@ namespace Newtonsoft.Json
t = WriteEndAsync(token, cancellationToken);
if (!t.IsCompletedSucessfully())
{
return AwaitEnd(t, levelsToComplete, type, cancellationToken);
return AwaitEnd(t, levelsToComplete, cancellationToken);
}
UpdateCurrentState();
@@ -321,7 +321,7 @@ namespace Newtonsoft.Json
return AsyncUtils.CompletedTask;
// Local functions, params renamed (capitalized) so as not to capture and allocate when calling async
async Task AwaitProperty(Task task, int LevelsToComplete, JsonToken token, JsonContainerType Type, CancellationToken CancellationToken)
async Task AwaitProperty(Task task, int LevelsToComplete, JsonToken token, CancellationToken CancellationToken)
{
await task.ConfigureAwait(false);
@@ -338,10 +338,10 @@ namespace Newtonsoft.Json
UpdateCurrentState();
await AwaitRemaining(LevelsToComplete, Type, CancellationToken).ConfigureAwait(false);
await AwaitRemaining(LevelsToComplete, CancellationToken).ConfigureAwait(false);
}
async Task AwaitIndent(Task task, int LevelsToComplete, JsonToken token, JsonContainerType Type, CancellationToken CancellationToken)
async Task AwaitIndent(Task task, int LevelsToComplete, JsonToken token, CancellationToken CancellationToken)
{
await task.ConfigureAwait(false);
@@ -351,10 +351,10 @@ namespace Newtonsoft.Json
UpdateCurrentState();
await AwaitRemaining(LevelsToComplete, Type, CancellationToken).ConfigureAwait(false);
await AwaitRemaining(LevelsToComplete, CancellationToken).ConfigureAwait(false);
}
async Task AwaitEnd(Task task, int LevelsToComplete, JsonContainerType Type, CancellationToken CancellationToken)
async Task AwaitEnd(Task task, int LevelsToComplete, CancellationToken CancellationToken)
{
await task.ConfigureAwait(false);
@@ -362,10 +362,10 @@ namespace Newtonsoft.Json
UpdateCurrentState();
await AwaitRemaining(LevelsToComplete, Type, CancellationToken).ConfigureAwait(false);
await AwaitRemaining(LevelsToComplete, CancellationToken).ConfigureAwait(false);
}
async Task AwaitRemaining(int LevelsToComplete, JsonContainerType Type, CancellationToken CancellationToken)
async Task AwaitRemaining(int LevelsToComplete, CancellationToken CancellationToken)
{
while (LevelsToComplete-- > 0)
{