Skip to content

Commit

Permalink
fix: Don't iterate with every parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
VelvetToroyashi committed Nov 12, 2023
1 parent 8039608 commit b942471
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Remora.Commands/Trees/Nodes/CommandNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,13 @@ public bool TryBind
var boundParameters = new List<BoundParameterShape>();
while (parametersToCheck.Count > 0)
{
// Because the current enumerator might be invalid or ended, we'll fix up the key-value pair here
var current = enumerator.MoveNext()
? enumerator.Current
: KeyValuePair.Create(string.Empty, (IReadOnlyList<string>)Array.Empty<string>());
var matchedParameters = new List<IParameterShape>();
foreach (var parameterToCheck in parametersToCheck)
{
// Because the current enumerator might be invalid or ended, we'll fix up the key-value pair here
var current = enumerator.MoveNext()
? enumerator.Current
: KeyValuePair.Create(string.Empty, (IReadOnlyList<string>)Array.Empty<string>());

if (!parameterToCheck.Matches(current, out var isFatal, searchOptions))
{
if (isFatal)
Expand Down

0 comments on commit b942471

Please sign in to comment.