Our website uses cookies to enhance your browsing experience.
Accept
to the top

Webinar: Let's make a programming language. Lexer - 29.04

>
>
>
Examples of errors detected by the...

Examples of errors detected by the V3191 diagnostic

V3191. Iteration through collection makes no sense because it is always empty.


S&Box

V3191 Iteration through the 'results' collection makes no sense because it is always empty. ConVarSystem.AutoComplete.cs 23


public static ConCmdAttribute.AutoCompleteResult[]
  GetAutoComplete(....)
{
  var parts = partial.SplitQuotesStrings();

  List<ConCmdAttribute.AutoCompleteResult> results = new();

  // if we have more than one part, complete a specific command
  if ( parts.Length > 1 )
  {
    if ( !Members.TryGetValue( parts[0], out var command )
      return Array
             .Empty<ConCmdAttribute.AutoCompleteResult>();

  //results.Add( new ConCmd.AutoCompleteResult
  //  { Command = command.Name, Description = command.Help } );

  // TODO - dig into it for auto complete
  return results.Take( count ).ToArray();
}