public SyntaxNode ToListNode() { switch (this._count) { case 0: return(null); case 1: return(this._nodes[0]); case 2: return(SyntaxList.List(this._nodes[0], this._nodes[1])); } return(SyntaxList.List(this.ToArray())); }
internal static SyntaxNode Concat(SyntaxNode left, SyntaxNode right) { if ((left == null)) { return(right); } if ((right == null)) { return(left); } ArrayElement <SyntaxNode>[] tmp; SyntaxList leftList = (left as SyntaxList); SyntaxList rightList = (right as SyntaxList); if (leftList != null) { if (rightList != null) { tmp = new ArrayElement <SyntaxNode> [left.SlotCount + right.SlotCount]; leftList.CopyTo(tmp, 0); rightList.CopyTo(tmp, left.SlotCount); return(SyntaxList.List(tmp)); } tmp = new ArrayElement <SyntaxNode> [(left.SlotCount + 1)]; leftList.CopyTo(tmp, 0); tmp[left.SlotCount].Value = right; return(SyntaxList.List(tmp)); } if (rightList != null) { tmp = new ArrayElement <SyntaxNode> [(rightList.SlotCount + 1)]; tmp[0].Value = left; rightList.CopyTo(tmp, 1); return(SyntaxList.List(tmp)); } return(SyntaxList.List(left, right)); }