protected override string GenerateNameForExpression( SemanticModel semanticModel, ExpressionSyntax expression, CancellationToken cancellationToken ) => semanticModel.GenerateNameForExpression( expression, capitalize: false, cancellationToken: cancellationToken );
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)); }
public string GenerateNameForExpression( SemanticModel semanticModel, SyntaxNode expression, bool capitalize, CancellationToken cancellationToken ) => semanticModel.GenerateNameForExpression( (ExpressionSyntax)expression, capitalize, cancellationToken );
/// <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)); }
/// <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)); }
public string GenerateNameForExpression(SemanticModel semanticModel, SyntaxNode expression, bool capitalize = false) { return semanticModel.GenerateNameForExpression((ExpressionSyntax)expression, capitalize); }
public string GenerateNameForExpression(SemanticModel semanticModel, SyntaxNode expression, bool capitalize = false) { return(semanticModel.GenerateNameForExpression((ExpressionSyntax)expression, capitalize)); }