+ public Tree(Input.Region loc, NodeType head) { this(loc, head, null); }
+ public Tree(Input.Region loc, NodeType head, Tree<NodeType>[] children) { this(loc, head, children, false); }
+
+ // FIXME: fairly inefficient because we keep copying arrays
+ /** package-private constructor, allows setting the "lift" bit */
+ Tree(Input.Region loc, NodeType head, Tree<NodeType>[] children, boolean lift) {
+ this.location = loc;
+ this.ihead = head;
+ if (lift && children != null && children.length > 0) {
+ Tree<NodeType> last = children[children.length-1];
+ this.children = new Tree[(children.length-1)+last.children.length];
+ System.arraycopy(children, 0, this.children, 0, children.length-1);
+ if (last.children.length > 0)
+ System.arraycopy(last.children, 0, this.children, children.length-1, last.children.length);
+ } else {
+ this.children = ArrayUtil.clone(children, Tree.class);
+ }