public SyntaxList <AttributeListSyntax> GetAttributeListSyntaxList(DocumentationCommentList documentation = null)
        {
            var attributes = AttributeLists
                             .Select(attr => AttributeList(SingletonSeparatedList(attr.Attribute.GetAttributeSyntax())))
                             .ToArray();

            return((documentation == null) ? List(attributes)
                : GetListWithDocumentation(documentation, attributes));
        }
示例#2
0
 public Microsoft.CodeAnalysis.SyntaxToken GetToken(DocumentationCommentList documentationCommentList = null)
 => documentationCommentList == null
     ? Token(SyntaxKind)
     : Token(
     TriviaList(
         Trivia(
             documentationCommentList.GetDocumentationCommentTriviaSyntax())),
     SyntaxKind,
     TriviaList());
示例#3
0
 public Microsoft.CodeAnalysis.SyntaxToken GetSyntaxToken(DocumentationCommentList documentationCommentList = null)
 => documentationCommentList == null
     ? Identifier(Name.Value)
     : Identifier(
         TriviaList(
             Trivia(
                 documentationCommentList.GetDocumentationCommentTriviaSyntax())),
         Name.Value,
         TriviaList());
        private static SyntaxList <AttributeListSyntax> GetListWithDocumentation(DocumentationCommentList documentation, AttributeListSyntax[] attributes)
        {
            var list = new List <AttributeListSyntax>();

            for (int i = 0; i < attributes.Length; i++)
            {
                var attribute = attributes[i];
                if (i == 0)
                {
                    attribute = attribute.WithOpenBracketToken(
                        Token(
                            TriviaList(
                                Trivia(
                                    documentation.GetDocumentationCommentTriviaSyntax())),
                            SyntaxKind.OpenBracketToken,
                            TriviaList()));
                }
                list.Add(attribute);
            }
            return(List(list.ToArray()));
        }
示例#5
0
        public SyntaxTokenList GetSyntaxTokenList(DocumentationCommentList documentationCommentList = null)
        {
            if (documentationCommentList == null)
            {
                return(TokenList(
                           GetSyntaxTokensSorted().Select(s => s.GetToken())));
            }
            var sorted = GetSyntaxTokensSorted();
            var count  = sorted.Count();
            var list   = new List <Microsoft.CodeAnalysis.SyntaxToken>();

            for (int i = 0; i < count; i++)
            {
                if (i == 0)
                {
                    list.Add(sorted[i].GetToken(documentationCommentList));
                    continue;
                }
                list.Add(sorted[i].GetToken());
            }
            return(TokenList(list));
        }