コード例 #1
0
        /// <summary>Adds additional trailing trivia to an attribute list.</summary>
        public static LNodeList PlusTrailingTrivia(this LNodeList attrs, LNode trivia)
        {
            LNodeList oldTrivia;

            attrs = WithoutTrailingTrivia(attrs, out oldTrivia);
            return(attrs.Add(LNode.Call(S.TriviaTrailing, oldTrivia.Add(trivia))));
        }
コード例 #2
0
 public static LNodeList WithSpliced(this LNodeList list, LNode node, Symbol listName = null)
 {
     if (node.Calls(listName ?? CodeSymbols.Splice))
     {
         return(list.AddRange(node.Args));
     }
     else
     {
         return(list.Add(node));
     }
 }
コード例 #3
0
        /// <summary>Adds additional trailing trivia to an attribute list. Has no effect if <c>trivia</c> is empty.</summary>
        /// <remarks>
        /// Trailing trivia is represented by a call to <c>%trailing</c> in a node's
        /// attribute list; each argument to %trailing represents one piece of trivia.
        /// <para/>
        /// In the current design, this method has a side-effect of recreating the %trailing
        /// node at the end of the attribute list, and if there are multiple %trailing
        /// lists, consolidating them into a single list, but only if the specified <c>trivia</c>
        /// list is not empty.</remarks>
        public static LNodeList PlusTrailingTrivia(this LNodeList attrs, LNodeList trivia)
        {
            if (trivia.IsEmpty)
            {
                return(attrs);
            }
            LNodeList oldTrivia;

            attrs = WithoutTrailingTrivia(attrs, out oldTrivia);
            return(attrs.Add(LNode.Call(S.TriviaTrailing, oldTrivia.AddRange(trivia))));
        }