Ejemplo n.º 1
0
 static LNode MaybeQuoteList(VList <LNode> list, bool substitutions)
 {
     if (list.IsEmpty)
     {
         return(null);
     }
     else if (substitutions && list.Any(a => VarArgExpr(a) != null))
     {
         if (list.Count == 1)
         {
             return(F.Call(LNode_List, VarArgExpr(list[0])));
         }
         // If you write something like quote(Foo($x, $(...y), $z)), a special
         // output style is used to accommodate the variable argument list.
         LNode argList = F.Call(LNode_List);
         foreach (LNode arg in list)
         {
             var vae = VarArgExpr(arg);
             if (vae != null)
             {
                 argList = F.Call(F.Dot(argList, F.Id("AddRange")), vae);
             }
             else
             {
                 argList = F.Call(F.Dot(argList, F.Id("Add")), QuoteOne(arg, substitutions));
             }
         }
         return(argList);
     }
     else
     {
         return(F.Call(LNode_List, list.Select(item => QuoteOne(item, substitutions))));
     }
 }