Exemple #1
0
 public static EnumDeclarationSyntax AddModifiers(this EnumDeclarationSyntax cl, params SyntaxKind[] modifiers)
 {
     if (modifiers == null)
     {
         return(cl);
     }
     return(cl.AddModifiers(modifiers.Select(x => SyntaxFactory.Token(x)).ToArray()));
 }
        public CSharpSyntaxNode Convert(EnumDeclaration node)
        {
            EnumDeclarationSyntax csEnum = SyntaxFactory.EnumDeclaration(node.Name.Text);

            csEnum = csEnum.AddModifiers(node.Modifiers.ToCsNodes <SyntaxToken>());
            csEnum = csEnum.AddMembers(node.Members.ToCsNodes <EnumMemberDeclarationSyntax>());

            if (node.JsDoc.Count > 0)
            {
                csEnum = csEnum.WithLeadingTrivia(SyntaxFactory.Trivia(node.JsDoc[0].ToCsNode <DocumentationCommentTriviaSyntax>()));
            }

            return(csEnum);
        }