/// <summary> /// Initializes the node after being parsed by the parser. /// </summary> /// <param name="expression">Expression node defining the statement.</param> /// <param name="period">Optional period that terminates a statement.</param> /// <param name="nextStatement">Optional statement node that follows this statement.</param> protected internal void SetContents(ExpressionNode expression, SpecialCharacterToken period, StatementNode nextStatement) { if (expression == null) throw new ArgumentNullException("expression"); this.Expression = expression; this.Period = period; // Null is OK here. this.NextStatement = nextStatement; // Null is OK here. }
/// <summary> /// Initializes the node after being parsed by the parser. /// </summary> /// <param name="leftBar">Left vertical bar "|" token, if temporary variable definition is present.</param> /// <param name="temporaries">A collection of temporary variable nodes.</param> /// <param name="rightBar">Right vertical bar "|" token, if temporary variable definition is present.</param> /// <param name="statements">Executable statements defining the function.</param> protected internal void SetContents(VerticalBarToken leftBar, IEnumerable<TemporaryVariableNode> temporaries, VerticalBarToken rightBar, StatementNode statements) { this.Temporaries.Clear(); if (temporaries != null) this.Temporaries.AddRange(temporaries); this.LeftBar = leftBar; // Null if no temporaries this.RightBar = rightBar; // Null if no temporaries or illegal source code this.Statements = statements; // OK with null if ((this.Temporaries.Count != 0) && (this.LeftBar == null)) throw new ArgumentNullException("leftBar"); // Little late, but OK to throw the exception. }
/// <summary> /// Initializes the node after being parsed by the parser. /// </summary> /// <param name="arguments">Collection of block arguments for this block.</param> /// <param name="argumentsBar">The vertical bar after the block arguments.</param> /// <param name="leftBar">Left vertical bar "|" token, if temporary variable definition is present.</param> /// <param name="temporaries">A collection of temporary variable nodes.</param> /// <param name="rightBar">Right vertical bar "|" token, if temporary variable definition is present.</param> /// <param name="statements">Executable statements defining the function.</param> /// <param name="rightBracket">Token for the right / closing square bracket of the block.</param> protected internal void SetContents(IEnumerable<BlockArgumentNode> arguments, VerticalBarToken argumentsBar, VerticalBarToken leftBar, IEnumerable<TemporaryVariableNode> temporaries, VerticalBarToken rightBar, StatementNode statements, SpecialCharacterToken rightBracket) { if (arguments == null) throw new ArgumentNullException("arguments"); this.SetContents(leftBar, temporaries, rightBar, statements); this.Arguments.Clear(); this.Arguments.AddRange(arguments); this.ArgumentsBar = argumentsBar; // OK with null if no args. or illegal source this.RightBracket = rightBracket; // OK with null if illegal source }
/// <summary> /// Initializes the node after being parsed by the parser. /// </summary> /// <param name="leftBar">Left vertical bar "|" token, if temporary variable definition is present.</param> /// <param name="temporaries">A collection of temporary variable nodes.</param> /// <param name="rightBar">Right vertical bar "|" token, if temporary variable definition is present.</param> /// <param name="statements">Executable statements defining the function.</param> protected internal void SetContents(VerticalBarToken leftBar, IEnumerable <TemporaryVariableNode> temporaries, VerticalBarToken rightBar, StatementNode statements) { this.Temporaries.Clear(); if (temporaries != null) { this.Temporaries.AddRange(temporaries); } this.LeftBar = leftBar; // Null if no temporaries this.RightBar = rightBar; // Null if no temporaries or illegal source code this.Statements = statements; // OK with null if ((this.Temporaries.Count != 0) && (this.LeftBar == null)) { throw new ArgumentNullException("leftBar"); // Little late, but OK to throw the exception. } }