/// <summary> /// Initializes a new instance of <see cref="ConditionalStatement" /> for the specified condition, true statement and false statement. /// </summary> /// <param name="parent">The parent condition in a chain of if-elseif conditions.</param> /// <param name="condition">The condition that is tested.</param> /// <param name="thenStatement">The statement that is run when the condition evaluates to anything else but falsy.</param> /// <param name="elseStatement">The statement that is run when the condition evaluates to falsy.</param> public ConditionalStatement(ConditionalStatement parent, Expression condition, Statement thenStatement, Statement elseStatement) { _parent = parent; _condition = condition; _thenStatement = thenStatement; _elseStatement = elseStatement; }
/// <summary> /// Initializes a new instance of <see cref="LoopStatement" /> for the specified initializtion, condition, iteration and statement. /// </summary> /// <param name="initialization">The initialization of the loop.</param> /// <param name="condition">The condition of the loop.</param> /// <param name="iteration">The iteration of the loop.</param> /// <param name="statement">The statement to run in the loop.</param> /// <remarks> /// The Statement property cannot be null. Use an <see cref="EmptyStatement"/> statement if necessary. /// All of the other parameters are optional, leaving all of them out will result in an eternal loop. /// </remarks> public LoopStatement(Expression initialization, Expression condition, Expression iteration, Statement statement) { _initialization = initialization; _condition = condition; _iteration = iteration; _statement = statement; }
/// <summary> /// Initializes a new instance of <see cref="IteratorStatement" /> for the specified variable, collection and statement. /// </summary> /// <param name="variable">The variable that holds the item for an iteration.</param> /// <param name="collection">The collection on which to iterate.</param> /// <param name="statement">The statement to run on each iteration.</param> public IteratorStatement(Expression variable, Expression collection, Statement statement) { Variable = variable; Collection = collection; Statement = statement; }
/// <summary> /// Initializes a new instance of <see cref="ConditionalStatement" /> for the specified condition, true statement and false statement. /// </summary> /// <param name="condition">The condition that is tested.</param> /// <param name="thenStatement">The statement that is run when the condition evaluates to anything else but falsy.</param> /// <param name="elseStatement">The statement that is run when the condition evaluates to falsy.</param> public ConditionalStatement(Expression condition, Statement thenStatement, Statement elseStatement) : this(null, condition, thenStatement, elseStatement) { }
/// <summary> /// Initializes a new instance of <see cref="WhileStatement" /> for the specified condition and statement. /// </summary> /// <param name="condition">The condition to check in the loop.</param> /// <param name="statement">The statement to run in the loop.</param> public WhileStatement(Expression condition, Statement statement) { _condition = condition; _statement = statement; }
/// <summary> /// Returns a new instance of <see cref="LabelStatement" />. /// </summary> /// <param name="name">The name of the label.</param> /// <param name="statement">The statement this label precedes.</param> /// <returns>a new instance of <see cref="LabelStatement" />.</returns> public static LabelStatement Label(IdentifierExpression name, Statement statement) { return new LabelStatement(name, statement); }
/// <summary> /// Initializes a new instance of <see cref="DoWhileStatement" /> for the specified condition and statement. /// </summary> /// <param name="condition">The condition to check after the loop.</param> /// <param name="statement">The statement to run in the loop.</param> public DoWhileStatement(Expression condition, Statement statement) { Condition = condition; Statement = statement; }
/// <summary> /// Initializes a new instance of <see cref="WithStatement" /> for the specified expression and statement. /// </summary> /// <param name="expression">The expression to add to the scope.</param> /// <param name="statement">The statement to run in the scope.</param> public WithStatement(Expression expression, Statement statement) { _expression = expression; _statement = statement; }
/// <summary> /// Initializes a new instance of <see cref="LabelStatement" /> that precedes the specified statement with a label. /// </summary> /// <param name="name">The name of the label.</param> /// <param name="statement">The statement to precede.</param> public LabelStatement(IdentifierExpression name, Statement statement) { _name = name; _statement = statement; }