예제 #1
0
 public static IListSource <ILNode> GetTrailingTrivia(this ILNode node)
 {
     if (node is LNode)
     {
         VList <LNode> list = GetTrailingTrivia((LNode)node);
         if (list.IsEmpty)
         {
             return(EmptyList <ILNode> .Value);                  // avoid boxing in the common case
         }
         return(list.UpCast <LNode, ILNode>());
     }
     else
     {
         VList <ILNode> list = VList <ILNode> .Empty;
         foreach (ILNode a in node.Attrs())
         {
             if (a.Calls(S.TriviaTrailing))
             {
                 list.AddRange(a.Args());
             }
         }
         if (list.IsEmpty)
         {
             return(EmptyList <ILNode> .Value);                  // avoid boxing in the common case
         }
         return(list);
     }
 }