Skip to content

Commit

Permalink
Fix more async naming violation
Browse files Browse the repository at this point in the history
  • Loading branch information
Hsu Still committed Sep 2, 2017
1 parent e6912e2 commit b7fb44a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/Discord.Net.Commands/CommandParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ private enum ParserPart
QuotedParameter
}

public static async Task<ParseResult> ParseArgs(CommandInfo command, ICommandContext context, IServiceProvider services, string input, int startPos)
public static async Task<ParseResult> ParseArgsAsync(CommandInfo command, ICommandContext context, IServiceProvider services, string input, int startPos)
{
ParameterInfo curParam = null;
StringBuilder argBuilder = new StringBuilder(input.Length);
Expand Down Expand Up @@ -111,7 +111,7 @@ public static async Task<ParseResult> ParseArgs(CommandInfo command, ICommandCon
if (curParam == null)
return ParseResult.FromError(CommandError.BadArgCount, "The input text has too many parameters.");

var typeReaderResult = await curParam.Parse(context, argString, services).ConfigureAwait(false);
var typeReaderResult = await curParam.ParseAsync(context, argString, services).ConfigureAwait(false);
if (!typeReaderResult.IsSuccess && typeReaderResult.Error != CommandError.MultipleMatches)
return ParseResult.FromError(typeReaderResult);

Expand All @@ -134,7 +134,7 @@ public static async Task<ParseResult> ParseArgs(CommandInfo command, ICommandCon

if (curParam != null && curParam.IsRemainder)
{
var typeReaderResult = await curParam.Parse(context, argBuilder.ToString(), services).ConfigureAwait(false);
var typeReaderResult = await curParam.ParseAsync(context, argBuilder.ToString(), services).ConfigureAwait(false);
if (!typeReaderResult.IsSuccess)
return ParseResult.FromError(typeReaderResult);
argList.Add(typeReaderResult);
Expand Down
8 changes: 4 additions & 4 deletions src/Discord.Net.Commands/Info/CommandInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public async Task<ParseResult> ParseAsync(ICommandContext context, int startInde
return ParseResult.FromError(preconditionResult);

string input = searchResult.Text.Substring(startIndex);
return await CommandParser.ParseArgs(this, context, services, input, 0).ConfigureAwait(false);
return await CommandParser.ParseArgsAsync(this, context, services, input, 0).ConfigureAwait(false);
}

public Task<IResult> ExecuteAsync(ICommandContext context, ParseResult parseResult, IServiceProvider services)
Expand Down Expand Up @@ -163,11 +163,11 @@ public async Task<IResult> ExecuteAsync(ICommandContext context, IEnumerable<obj
switch (RunMode)
{
case RunMode.Sync: //Always sync
return await ExecuteAsyncInternal(context, args, services).ConfigureAwait(false);
return await ExecuteAsyncInternalAsync(context, args, services).ConfigureAwait(false);
case RunMode.Async: //Always async
var t2 = Task.Run(async () =>
{
await ExecuteAsyncInternal(context, args, services).ConfigureAwait(false);
await ExecuteAsyncInternalAsync(context, args, services).ConfigureAwait(false);
});
break;
}
Expand All @@ -179,7 +179,7 @@ public async Task<IResult> ExecuteAsync(ICommandContext context, IEnumerable<obj
}
}

private async Task<IResult> ExecuteAsyncInternal(ICommandContext context, object[] args, IServiceProvider services)
private async Task<IResult> ExecuteAsyncInternalAsync(ICommandContext context, object[] args, IServiceProvider services)
{
await Module.Service._cmdLogger.DebugAsync($"Executing {GetLogText(context)}").ConfigureAwait(false);
try
Expand Down
2 changes: 1 addition & 1 deletion src/Discord.Net.Commands/Info/ParameterInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public async Task<PreconditionResult> CheckPreconditionsAsync(ICommandContext co
return PreconditionResult.FromSuccess();
}

public async Task<TypeReaderResult> Parse(ICommandContext context, string input, IServiceProvider services = null)
public async Task<TypeReaderResult> ParseAsync(ICommandContext context, string input, IServiceProvider services = null)
{
services = services ?? EmptyServiceProvider.Instance;
return await _reader.ReadAsync(context, input, services).ConfigureAwait(false);
Expand Down
2 changes: 1 addition & 1 deletion src/Discord.Net.Commands/Readers/NullableTypeReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public override async Task<TypeReaderResult> ReadAsync(ICommandContext context,
{
if (string.Equals(input, "null", StringComparison.OrdinalIgnoreCase) || string.Equals(input, "nothing", StringComparison.OrdinalIgnoreCase))
return TypeReaderResult.FromSuccess(new T?());
return await _baseTypeReader.ReadAsync(context, input, services); ;
return await _baseTypeReader.ReadAsync(context, input, services);
}
}
}

0 comments on commit b7fb44a

Please sign in to comment.