private static SyntaxNode GetNewNode( DelegateDeclarationSyntax delegateDeclaration, TypeParameterConstraintSyntax constraint, SemanticModel semanticModel, CancellationToken cancellationToken) { TypeParameterListSyntax typeParameterList = delegateDeclaration.TypeParameterList; INamedTypeSymbol delegateSymbol = semanticModel.GetDeclaredSymbol(delegateDeclaration, cancellationToken); int position = (typeParameterList != null) ? typeParameterList.SpanStart : delegateDeclaration.Identifier.SpanStart; string name = GetTypeParameterName(position, semanticModel); DelegateDeclarationSyntax newNode = delegateDeclaration.AddTypeParameterListParameters(TypeParameter(Identifier(name).WithRenameAnnotation())); if (constraint != null) { newNode = newNode.AddConstraintClauses(TypeParameterConstraintClause(name, constraint)); } return(newNode); }