Пример #1
0
        public static ImmutableArray <ParameterName> GenerateParameterNames(
            this SemanticModel semanticModel,
            IEnumerable <AttributeArgumentSyntax> arguments,
            IList <string> reservedNames,
            CancellationToken cancellationToken
            )
        {
            reservedNames ??= SpecializedCollections.EmptyList <string>();

            // We can't change the names of named parameters.  Any other names we're flexible on.
            var isFixed = reservedNames
                          .Select(s => true)
                          .Concat(arguments.Select(a => a.NameEquals != null))
                          .ToImmutableArray();

            var parameterNames = reservedNames
                                 .Concat(
                arguments.Select(
                    a => semanticModel.GenerateNameForArgument(a, cancellationToken)
                    )
                )
                                 .ToImmutableArray();

            return(GenerateNames(reservedNames, isFixed, parameterNames));
        }
Пример #2
0
        public static IList <ParameterName> GenerateParameterNames(
            this SemanticModel semanticModel,
            IEnumerable <ArgumentSyntax> arguments,
            IList <string> reservedNames = null)
        {
            reservedNames = reservedNames ?? SpecializedCollections.EmptyList <string>();

            // We can't change the names of named parameters.  Any other names we're flexible on.
            var isFixed = reservedNames.Select(s => true).Concat(
                arguments.Select(a => a.NameColon != null)).ToList();

            var parameterNames = reservedNames.Concat(
                arguments.Select(a => semanticModel.GenerateNameForArgument(a))).ToList();

            return(GenerateNames(reservedNames, isFixed, parameterNames));
        }
        public static IList <string> GenerateParameterNames(
            this SemanticModel semanticModel,
            IEnumerable <AttributeArgumentSyntax> arguments,
            IList <string> reservedNames = null)
        {
            reservedNames = reservedNames ?? SpecializedCollections.EmptyList <string>();

            // We can't change the names of named parameters.  Any other names we're flexible on.
            var isFixed = reservedNames.Select(s => true).Concat(
                arguments.Select(a => a.NameEquals != null)).ToList();

            var parameterNames = reservedNames.Concat(
                arguments.Select(a => semanticModel.GenerateNameForArgument(a))).ToList();

            return(NameGenerator.EnsureUniqueness(parameterNames, isFixed).Skip(reservedNames.Count).ToList());
        }
Пример #4
0
 protected override string GenerateNameForArgument(
     SemanticModel semanticModel, AttributeArgumentSyntax argument)
 {
     return(semanticModel.GenerateNameForArgument(argument));
 }
Пример #5
0
 protected override string GenerateNameForArgument(SemanticModel semanticModel, AttributeArgumentSyntax argument, CancellationToken cancellationToken)
 => semanticModel.GenerateNameForArgument(argument, cancellationToken);