private static LocalFunctionStatementSyntax GetNewNode( LocalFunctionStatementSyntax localFunctionStatement, TypeParameterConstraintSyntax constraint, SemanticModel semanticModel, CancellationToken cancellationToken) { string name = GetMethodTypeParameterName(semanticModel, localFunctionStatement.BodyOrExpressionBody().SpanStart, cancellationToken); LocalFunctionStatementSyntax newNode = localFunctionStatement.AddTypeParameterListParameters(TypeParameter(Identifier(name).WithRenameAnnotation())); if (constraint != null) { newNode = newNode.AddConstraintClauses(TypeParameterConstraintClause(name, constraint)); } return(newNode); }