Skip to content

Commit 949d5cd

Browse files
Deduplicate returnVal assignment and return logic for Char.IsDigit overloads
Co-authored-by: YuliiaKovalova <95473390+YuliiaKovalova@users.noreply.github.com>
1 parent fda73b3 commit 949d5cd

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Build/Evaluation/Expander/WellKnownFunctions.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -879,15 +879,21 @@ internal static bool TryExecuteWellKnownFunction(string methodName, Type receive
879879
{
880880
if (string.Equals(methodName, nameof(char.IsDigit), StringComparison.OrdinalIgnoreCase))
881881
{
882+
bool? result = null;
883+
882884
if (ParseArgs.TryGetArg(args, out string? arg0) && arg0?.Length == 1)
883885
{
884886
char c = arg0[0];
885-
returnVal = char.IsDigit(c);
886-
return true;
887+
result = char.IsDigit(c);
887888
}
888889
else if (ParseArgs.TryGetArgs(args, out string? str, out int index) && str != null)
889890
{
890-
returnVal = char.IsDigit(str, index);
891+
result = char.IsDigit(str, index);
892+
}
893+
894+
if (result.HasValue)
895+
{
896+
returnVal = result.Value;
891897
return true;
892898
}
893899
}

0 commit comments

Comments
 (0)