private static StructDeclarationSyntax AddBaseType(StructDeclarationSyntax structDeclaration, BaseTypeSyntax baseType)
        {
            BaseListSyntax baseList = structDeclaration.BaseList;

            if (baseList == null)
            {
                baseList = BaseList(baseType);

                TypeParameterListSyntax typeParameterList = structDeclaration.TypeParameterList;

                if (typeParameterList != null)
                {
                    return(structDeclaration
                           .WithTypeParameterList(typeParameterList.WithoutTrailingTrivia())
                           .WithBaseList(baseList.WithTrailingTrivia(typeParameterList.GetTrailingTrivia())));
                }
                else
                {
                    SyntaxToken identifier = structDeclaration.Identifier;

                    return(structDeclaration
                           .WithIdentifier(identifier.WithoutTrailingTrivia())
                           .WithBaseList(baseList.WithTrailingTrivia(identifier.TrailingTrivia)));
                }
            }
            else
            {
                SeparatedSyntaxList <BaseTypeSyntax> types = baseList.Types;

                BaseTypeSyntax lastType = types.LastOrDefault();

                if (lastType == null ||
                    (types.Count == 1 && types[0].IsMissing))
                {
                    SyntaxToken colonToken = baseList.ColonToken;

                    baseType = baseType
                               .WithLeadingTrivia(Space)
                               .WithTrailingTrivia(colonToken.TrailingTrivia);

                    baseList = baseList
                               .WithColonToken(colonToken.WithoutTrailingTrivia())
                               .WithTypes(SingletonSeparatedList(baseType));

                    return(structDeclaration.WithBaseList(baseList));
                }
                else
                {
                    types = types
                            .Replace(lastType, lastType.WithoutTrailingTrivia())
                            .Add(baseType.WithTrailingTrivia(lastType.GetTrailingTrivia()));

                    return(structDeclaration.WithBaseList(baseList.WithTypes(types)));
                }
            }
        }
 public override TNode LastOrDefault()
 => SyntaxWrapper.Wrap(syntaxList.LastOrDefault());