public ArrayType() { current = next = null; }
public override TypeBase Add(TypeBase right) { if (right == null) return this; //string thisV = this.FriendlyVal(); //Console.WriteLine("{0} + {1}", this.FriendlyVal(), right.FriendlyVal()); if (right is ArrayType) { ArrayType arr = right as ArrayType; if (current == null) { current = arr.current; next = arr.next; } else if (next == null || next.current == null) next = arr; else { ArrayType tmp = next; while (tmp.next != null && tmp.current != null) tmp = tmp.next; if (tmp.current == null) { tmp.current = arr.current; tmp.next = arr.next; } else { tmp.next = right as ArrayType; } } } else { this.Append(right); } return this; }
public void Append(TypeBase v) { if (v is ArrayBoundType) { foreach (TypeBase b in (v as ArrayBoundType).Items) { this.Append(b); } } //else if (v is ArrayType) //{ // ArrayType arr = v as ArrayType; // if (!arr.IsEmpty()) // { // if (current == null) // { // current = arr.current; // next = arr.next; // } // else if (next == null) // { // next = arr; // } // else // { // next.Append(v); // } // } //} else { if (current == null) { current = v; } else if (next == null) { next = new ArrayType(); next.Append(v); } else { next.Append(v); } } }