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 null
(AstNode kid)
| 266 | * @throws IllegalArgumentException if kid is {@code null} |
| 267 | */ |
| 268 | public void addChild(AstNode kid) { |
| 269 | assertNotNull(kid); |
| 270 | int end = kid.getPosition() + kid.getLength(); |
| 271 | setLength(end - this.getPosition()); |
| 272 | addChildToBack(kid); |
| 273 | kid.setParent(this); |
| 274 | } |
| 275 | |
| 276 | /** |
| 277 | * Returns the root of the tree containing this node. |
no test coverage detected