Loyc.Syntax.LNodeExt.AsLNode C# (CSharp) Method

AsLNode() public static method

Converts a list of LNodes to a single LNode by using the list as the argument list in a call to the specified identifier, or, if the list contains a single item, by returning that single item.
This is the reverse of the operation performed by AsList(LNode,Symbol).
public static AsLNode ( this list, Symbol listIdentifier ) : LNode
list this
listIdentifier Symbol Target of the node that is created if list /// does not contain exactly one item. Typical values include "'{}" and "#splice".
return LNode
		public static LNode AsLNode(this VList<LNode> list, Symbol listIdentifier)
		{
			if (list.Count == 1)
				return list[0];
			else {
				var r = SourceRange.Nowhere;
				if (list.Count != 0) {
					r = list[0].Range;
					r = new SourceRange(r.Source, r.StartIndex, list.Last.Range.EndIndex - r.StartIndex);
				}
 				return LNode.Call(listIdentifier, list, r);
			}
		}