예제 #1
0
 /**
  * Adds a child or function to the end of the block. Sets the parent of the child to this node,
  * and fixes up the start position of the child to be relative to this node. Sets the length of
  * this node to include the new child.
  *
  * @param kid the child
  * @throws IllegalArgumentException if kid is {@code null}
  */
 public void addChild(AstNode kid) {
   assertNotNull(kid);
   int end = kid.getPosition() + kid.getLength();
   setLength(end - this.getPosition());
   addChildToBack(kid);
   kid.setParent(this);
 }
예제 #2
0
 /**
  * Sets the node start and end positions. Computes the length as ({@code end} - {@code position}).
  */
 public void setBounds(int position, int end) {
   setPosition(position);
   setLength(end - position);
 }