/** * Adds a parameter to the function parameter list. * Sets the parent of the param node to this node. * @param param the parameter * @throws IllegalArgumentException if param is {@code null} */ public void addParam(AstNode param) { assertNotNull(param); if (params == null) { params = new ArrayList<AstNode>(); } params.add(param); param.setParent(this); }
/** * Adds a parameter to the function parameter list. * Sets the parent of the param node to this node. * @param param the parameter * @throws IllegalArgumentException if param is {@code null} */ public void addParam(AstNode param) { assertNotNull(param); if (params == null) { params = new ArrayList<AstNode>(); } params.add(param); param.setParent(this); }
/** * Adds a parameter to the function parameter list. * Sets the parent of the param node to this node. * @param param the parameter * @throws IllegalArgumentException if param is {@code null} */ public void addParam(AstNode param) { assertNotNull(param); if (params == null) { params = new ArrayList<AstNode>(); } params.add(param); param.setParent(this); }
/** * Adds a parameter to the function parameter list. * Sets the parent of the param node to this node. * @param param the parameter * @throws IllegalArgumentException if param is {@code null} */ public void addParam(AstNode param) { assertNotNull(param); if (params == null) { params = new ArrayList<AstNode>(); } params.add(param); param.setParent(this); }
/** * Sets function body, and sets its parent to this node. * Also sets the encoded source bounds based on the body bounds. * Assumes the function node absolute position has already been set, * and the body node's absolute position and length are set.<p> * * @param body function body. Its parent is set to this node, and its * position is updated to be relative to this node. * * @throws IllegalArgumentException if body is {@code null} */ public void setBody(AstNode body) { assertNotNull(body); this.body = body; if (Boolean.TRUE.equals(body.getProp(Node.EXPRESSION_CLOSURE_PROP))) { setIsExpressionClosure(true); } int absEnd = body.getPosition() + body.getLength(); body.setParent(this); this.setLength(absEnd - this.position); setEncodedSourceBounds(this.position, absEnd); }
/** * Sets function body, and sets its parent to this node. * Also sets the encoded source bounds based on the body bounds. * Assumes the function node absolute position has already been set, * and the body node's absolute position and length are set.<p> * * @param body function body. Its parent is set to this node, and its * position is updated to be relative to this node. * * @throws IllegalArgumentException if body is {@code null} */ public void setBody(AstNode body) { assertNotNull(body); this.body = body; if (Boolean.TRUE.equals(body.getProp(Node.EXPRESSION_CLOSURE_PROP))) { setIsExpressionClosure(true); } int absEnd = body.getPosition() + body.getLength(); body.setParent(this); this.setLength(absEnd - this.position); setEncodedSourceBounds(this.position, absEnd); }
/** * Sets function body, and sets its parent to this node. * Also sets the encoded source bounds based on the body bounds. * Assumes the function node absolute position has already been set, * and the body node's absolute position and length are set.<p> * * @param body function body. Its parent is set to this node, and its * position is updated to be relative to this node. * * @throws IllegalArgumentException if body is {@code null} */ public void setBody(AstNode body) { assertNotNull(body); this.body = body; if (Boolean.TRUE.equals(body.getProp(Node.EXPRESSION_CLOSURE_PROP))) { setIsExpressionClosure(true); } int absEnd = body.getPosition() + body.getLength(); body.setParent(this); this.setLength(absEnd - this.position); setEncodedSourceBounds(this.position, absEnd); }
/** * Sets function body, and sets its parent to this node. * Also sets the encoded source bounds based on the body bounds. * Assumes the function node absolute position has already been set, * and the body node's absolute position and length are set.<p> * * @param body function body. Its parent is set to this node, and its * position is updated to be relative to this node. * * @throws IllegalArgumentException if body is {@code null} */ public void setBody(AstNode body) { assertNotNull(body); this.body = body; if (Boolean.TRUE.equals(body.getProp(Node.EXPRESSION_CLOSURE_PROP))) { setIsExpressionClosure(true); } int absEnd = body.getPosition() + body.getLength(); body.setParent(this); this.setLength(absEnd - this.position); setEncodedSourceBounds(this.position, absEnd); }