internal bool IsAnyAliasInUse( ISymbol item, [MaybeNullWhen(false)] out string aliasAlreadyInUse) { EnsureAliasIndexIsCurrent(); if (item is IArgument) { // arguments don't have aliases so match based on Name for (var i = 0; i < Items.Count; i++) { var existing = Items[i]; if (string.Equals(item.Name, existing.Name, StringComparison.Ordinal)) { aliasAlreadyInUse = existing.Name; return(true); } } } else { var itemRawAliases = item.Aliases.ToArray(); for (var i = 0; i < itemRawAliases.Length; i++) { var alias = itemRawAliases[i]; if (ItemsByAlias.ContainsKey(alias)) { aliasAlreadyInUse = alias; return(true); } } } aliasAlreadyInUse = null !; return(false); }
internal bool IsAnyAliasInUse( ISymbol item, [MaybeNullWhen(false)] out string aliasAlreadyInUse ) { EnsureAliasIndexIsCurrent(); if (item is IIdentifierSymbol identifier) { var aliases = identifier.Aliases.ToArray(); for (var i = 0; i < aliases.Length; i++) { var alias = aliases[i]; if (ItemsByAlias.ContainsKey(alias)) { aliasAlreadyInUse = alias; return(true); } } } else { for (var i = 0; i < Items.Count; i++) { var existing = Items[i]; if (string.Equals(item.Name, existing.Name, StringComparison.Ordinal)) { aliasAlreadyInUse = existing.Name; return(true); } } } aliasAlreadyInUse = null !; return(false); }