/// <summary>Sets function body, and sets its parent to this node.</summary> /// <remarks> /// 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> /// </remarks> /// <param name="body"> /// function body. Its parent is set to this node, and its /// position is updated to be relative to this node. /// </param> /// <exception cref="System.ArgumentException"> /// if body is /// <code>null</code> /// </exception> public virtual void SetBody(AstNode body) { AssertNotNull(body); this.body = body; if (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); }