private void GetParameters( IList <TArgumentSyntax> arguments, IList <TAttributeArgumentSyntax> attributeArguments, IList <ITypeSymbol> parameterTypes, IList <string> parameterNames, out Dictionary <string, ISymbol> parameterToExistingFieldMap, out Dictionary <string, string> parameterToNewFieldMap, out List <IParameterSymbol> parameters) { parameterToExistingFieldMap = new Dictionary <string, ISymbol>(); parameterToNewFieldMap = new Dictionary <string, string>(); parameters = new List <IParameterSymbol>(); for (var i = 0; i < parameterNames.Count; i++) { // See if there's a matching field we can use. First test in a case sensitive // manner, then case insensitively. if (!TryFindMatchingField(arguments, attributeArguments, parameterNames, parameterTypes, i, parameterToExistingFieldMap, parameterToNewFieldMap, caseSentitive: true)) { if (!TryFindMatchingField(arguments, attributeArguments, parameterNames, parameterTypes, i, parameterToExistingFieldMap, parameterToNewFieldMap, caseSentitive: false)) { parameterToNewFieldMap[parameterNames[i]] = parameterNames[i]; } } parameters.Add(CodeGenerationSymbolFactory.CreateParameterSymbol( attributes: null, refKind: service.GetRefKind(arguments[i]), isParams: false, type: parameterTypes[i], name: parameterNames[i])); } }
private void GetParameters( ImmutableArray <TArgumentSyntax> arguments, ImmutableArray <TAttributeArgumentSyntax>?attributeArguments, ImmutableArray <ITypeSymbol> parameterTypes, ImmutableArray <ParameterName> parameterNames, out Dictionary <string, ISymbol> parameterToExistingFieldMap, out Dictionary <string, string> parameterToNewFieldMap, out ImmutableArray <IParameterSymbol> parameters) { parameterToExistingFieldMap = new Dictionary <string, ISymbol>(); parameterToNewFieldMap = new Dictionary <string, string>(); var result = ArrayBuilder <IParameterSymbol> .GetInstance(); for (var i = 0; i < parameterNames.Length; i++) { // See if there's a matching field we can use. First test in a case sensitive // manner, then case insensitively. if (!TryFindMatchingField( arguments, attributeArguments, parameterNames, parameterTypes, i, parameterToExistingFieldMap, parameterToNewFieldMap, caseSensitive: true, newParameterNames: out parameterNames)) { if (!TryFindMatchingField(arguments, attributeArguments, parameterNames, parameterTypes, i, parameterToExistingFieldMap, parameterToNewFieldMap, caseSensitive: false, newParameterNames: out parameterNames)) { parameterToNewFieldMap[parameterNames[i].BestNameForParameter] = parameterNames[i].NameBasedOnArgument; } } result.Add(CodeGenerationSymbolFactory.CreateParameterSymbol( attributes: default(ImmutableArray <AttributeData>), refKind: _service.GetRefKind(arguments[i]), isParams: false, type: parameterTypes[i], name: parameterNames[i].BestNameForParameter)); } parameters = result.ToImmutableAndFree(); }