MCPcopy Create free account
hub / github.com/mozilla/rhino / addChild

Method addChild

rhino/src/main/java/org/mozilla/javascript/ast/AstNode.java:268–274  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 3

statementsMethod · 0.95
switchStatementMethod · 0.80
addStatementMethod · 0.80

Calls 7

assertNotNullMethod · 0.95
setLengthMethod · 0.95
getPositionMethod · 0.95
addChildToBackMethod · 0.80
setParentMethod · 0.80
getPositionMethod · 0.65
getLengthMethod · 0.65

Tested by

no test coverage detected