예제 #1
0
 protected override string GenerateNameForExpression(
     SemanticModel semanticModel,
     ExpressionSyntax expression,
     CancellationToken cancellationToken
     ) =>
 semanticModel.GenerateNameForExpression(
     expression,
     capitalize: false,
     cancellationToken: cancellationToken
     );
예제 #2
0
        public static string GenerateNameForArgument(
            this SemanticModel semanticModel, AttributeArgumentSyntax argument)
        {
            // If it named argument then we use the name provided.
            if (argument.NameEquals != null)
            {
                return(argument.NameEquals.Name.Identifier.ValueText);
            }

            return(semanticModel.GenerateNameForExpression(argument.Expression));
        }
예제 #3
0
 public string GenerateNameForExpression(
     SemanticModel semanticModel,
     SyntaxNode expression,
     bool capitalize,
     CancellationToken cancellationToken
     ) =>
 semanticModel.GenerateNameForExpression(
     (ExpressionSyntax)expression,
     capitalize,
     cancellationToken
     );
예제 #4
0
        /// <summary>
        /// Given an argument node, tries to generate an appropriate name that can be used for that
        /// argument.
        /// </summary>
        public static string GenerateNameForArgument(
            this SemanticModel semanticModel, ArgumentSyntax argument, CancellationToken cancellationToken)
        {
            // If it named argument then we use the name provided.
            if (argument.NameColon != null)
            {
                return(argument.NameColon.Name.Identifier.ValueText);
            }

            return(semanticModel.GenerateNameForExpression(
                       argument.Expression, capitalize: false, cancellationToken: cancellationToken));
        }
예제 #5
0
        /// <summary>
        /// Given an argument node, tries to generate an appropriate name that can be used for that
        /// argument.
        /// </summary>
        public static string GenerateNameForArgument(
            this SemanticModel semanticModel, ArgumentSyntax argument)
        {
            // If it named argument then we use the name provided.
            if (argument.NameColon != null)
            {
                return(argument.NameColon.Name.Identifier.ValueText);
            }

            if (argument.Declaration != null)
            {
                return(argument.Declaration.Variables.First().Identifier.ValueText.ToCamelCase());
            }

            return(semanticModel.GenerateNameForExpression(argument.Expression));
        }
예제 #6
0
 public string GenerateNameForExpression(SemanticModel semanticModel, SyntaxNode expression, bool capitalize = false)
 {
     return semanticModel.GenerateNameForExpression((ExpressionSyntax)expression, capitalize);
 }
예제 #7
0
 public string GenerateNameForExpression(SemanticModel semanticModel, SyntaxNode expression, bool capitalize = false)
 {
     return(semanticModel.GenerateNameForExpression((ExpressionSyntax)expression, capitalize));
 }