/// <summary>
 /// Initializes a new instance of <see cref="ExceptionHandlingStatement" /> for the specified try, catch and finally blocks.
 /// </summary>
 /// <param name="tryBlock">The try block of the statement.</param>
 /// <param name="catchVariable">The variable that contains the exception for the catch block.</param>
 /// <param name="catchBlock">The catch block of the statement.</param>
 /// <param name="finallyBlock">The finally block of the statement.</param>
 public ExceptionHandlingStatement(CompoundStatement tryBlock, IdentifierExpression catchVariable, CompoundStatement catchBlock, CompoundStatement finallyBlock)
 {
     _tryBlock = tryBlock;
     _catchVariable = catchVariable;
     _catchBlock = catchBlock;
     _finallyBlock = finallyBlock;
 }
        /// <summary>
        /// Creates a new instance of <see cref="PropertyOperationExpression" /> that performs a property operation on the specified expression.
        /// </summary>
        /// <param name="expression">The expression on which to perform the property operation.</param>
        /// <param name="member">The property to access.</param>
        /// <returns>a new instance of <see cref="PropertyOperationExpression" />.</returns>
        public static PropertyOperationExpression Dot(this Expression expression, IdentifierExpression member)
        {
            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }

            return new PropertyOperationExpression(expression, member);
        }
        /// <summary>
        /// Creates a new instance of <see cref="ExceptionHandlingStatement" /> by copying the <see cref="ExceptionHandlingStatement.TryBlock" /> 
        /// and <see cref="ExceptionHandlingStatement.FinallyBlock" /> from the specified statement, and adding the specified expression and statements to the <see cref="ExceptionHandlingStatement.CatchBlock" />.
        /// </summary>
        /// <param name="statement">The statement from which to copy the <see cref="ExceptionHandlingStatement.TryBlock" /> and <see cref="ExceptionHandlingStatement.FinallyBlock" /> properties.</param>
        /// <param name="expression">The expression to set in the Catch block.</param>
        /// <param name="statements">A sequence of statements to add to the Catch block.</param>
        /// <returns>a new instance of <see cref="ExceptionHandlingStatement" />.</returns>
        public static ExceptionHandlingStatement Catch(this ExceptionHandlingStatement statement, IdentifierExpression expression, IEnumerable<Statement> statements)
        {
            if (statement == null)
            {
                throw new ArgumentNullException("statement");
            }

            return Catch(statement, expression, new CompoundStatement(statements));
        }
        /// <summary>
        /// Precedes a statement with a new instance of <see cref="LabelStatement" /> that adds the specified label.
        /// </summary>
        /// <param name="statement">The statement to precede.</param>
        /// <param name="expression">The label to add.</param>
        /// <returns>An instance of <see cref="LabelStatement" />.</returns>
        public static LabelStatement Labeled(this Statement statement, IdentifierExpression expression)
        {
            if (statement == null)
            {
                throw new ArgumentNullException("statement");
            }

            return new LabelStatement(expression, statement);
        }
        /// <summary>
        /// Creates a new instance of <see cref="ExceptionHandlingStatement" /> by copying the <see cref="ExceptionHandlingStatement.TryBlock" /> 
        /// and <see cref="ExceptionHandlingStatement.FinallyBlock" /> from the specified statement, and adding the specified expression and statements to the <see cref="ExceptionHandlingStatement.CatchBlock" />.
        /// </summary>
        /// <param name="statement">The statement from which to copy the <see cref="ExceptionHandlingStatement.TryBlock" /> and <see cref="ExceptionHandlingStatement.FinallyBlock" /> properties.</param>
        /// <param name="expression">The expression to set in the Catch block.</param>
        /// <param name="block">The block to use as the Catch block.</param>
        /// <returns>a new instance of <see cref="ExceptionHandlingStatement" />.</returns>
        public static ExceptionHandlingStatement Catch(this ExceptionHandlingStatement statement, IdentifierExpression expression, CompoundStatement block)
        {
            if (statement == null)
            {
                throw new ArgumentNullException("statement");
            }

            return new ExceptionHandlingStatement(statement.TryBlock, expression, block, statement.FinallyBlock);
        }
Пример #6
0
        /// <summary>
        /// Initializes a new instance of <see cref="FunctionExpression" /> with the specified name and parameters.
        /// </summary>
        /// <param name="name">The name of the function, if not anonymous.</param>
        /// <param name="parameters">The parameters that the function expects.</param>
        public FunctionExpression(IdentifierExpression name, params IdentifierExpression[] parameters)
        {
            _name = name;

            if (parameters != null)
            {
                _parameters.AddRange(parameters);
            }
        }
Пример #7
0
        /// <summary>
        /// Initializes a new instance of <see cref="FunctionExpression" /> for the specified name, parameters and body.
        /// </summary>
        /// <param name="name">The name of the function, if not anonymous.</param>
        /// <param name="parameters">The parameters that the function expects.</param>
        /// <param name="body">The body of the function.</param>
        public FunctionExpression(IdentifierExpression name, IEnumerable<IdentifierExpression> parameters, CompoundStatement body)
        {
            _name = name;
            _body = body;

            if (parameters != null)
            {
                _parameters.AddRange(parameters);
            }
        }
Пример #8
0
 public static FunctionExpression Function(IdentifierExpression name = null)
 {
     return(new FunctionExpression(name));
 }
Пример #9
0
 public static FunctionExpression Function(IdentifierExpression name = null)
 {
     return new FunctionExpression(name);
 }
Пример #10
0
 /// <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);
 }
Пример #11
0
 public static BreakStatement Break(IdentifierExpression label = null)
 {
     return new BreakStatement(label);
 }
Пример #12
0
 public static ContinueStatement Continue(IdentifierExpression label = null)
 {
     return new ContinueStatement(label);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BreakStatement" /> class for the specified label.
 /// </summary>
 /// <param name="label">A label that the break statement must refer to.</param>
 public BreakStatement(IdentifierExpression label)
 {
     Label = label;
 }
Пример #14
0
 /// <summary>
 /// Initializes a new instance of <see cref="ContinueStatement" /> that jumps to the specified label.
 /// </summary>
 /// <param name="label">The name of the label to jump to.</param>
 public ContinueStatement(IdentifierExpression label)
 {
     Label = label;
 }
Пример #15
0
 public static BreakStatement Break(IdentifierExpression label = null)
 {
     return(new BreakStatement(label));
 }
Пример #16
0
 /// <summary>
 /// Initializes a new instance of <see cref="ContinueStatement" /> that jumps to the specified label.
 /// </summary>
 /// <param name="label">The name of the label to jump to.</param>
 public ContinueStatement(IdentifierExpression label)
 {
     Label = label;
 }
Пример #17
0
 public static ContinueStatement Continue(IdentifierExpression label = null)
 {
     return(new ContinueStatement(label));
 }
Пример #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BreakStatement" /> class for the specified label.
 /// </summary>
 /// <param name="label">A label that the break statement must refer to.</param>
 public BreakStatement(IdentifierExpression label)
 {
     Label = label;
 }
Пример #19
0
 /// <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="PropertyOperationExpression" /> for the specified left and right operands.
 /// </summary>
 /// <param name="operandLeft">The left operand of the operation.</param>
 /// <param name="operandRight">The right operand of the operation.</param>
 public PropertyOperationExpression(Expression operandLeft, IdentifierExpression operandRight)
 {
     _operandLeft = operandLeft;
     _operandRight = operandRight;
 }
Пример #21
0
 /// <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;
 }