Exemplo n.º 1
0
 public virtual Expression visit(IncrementExpression expression)
 {
     return(expression);
 }
        /// <summary>
        /// Reads a primary increment expression.
        /// </summary>
        /// <param name="leftHandSide">The expression on the left hand side of the operator.</param>
        /// <param name="previousPrecedence">The precedence of the expression just before this one.</param>
        /// <returns>Returns the expression.</returns>
        private IncrementExpression GetPrimaryIncrementExpression(
            Expression leftHandSide, ExpressionPrecedence previousPrecedence)
        {
            Param.AssertNotNull(leftHandSide, "leftHandSide");
            Param.Ignore(previousPrecedence);

            IncrementExpression expression = null;

            // Check the previous precedence to see if we are allowed to gather up the as expression.
            if (this.CheckPrecedence(previousPrecedence, ExpressionPrecedence.Primary))
            {
                // Make sure the left hand side has at least one token.
                Debug.Assert(leftHandSide.Tokens.First != null, "The left hand side should not be empty.");

                // Get the increment symbol.
                this.tokens.Add(this.GetOperatorToken(OperatorType.Increment));
                
                // Create the partial token list for the expression.
                CsTokenList partialTokens = new CsTokenList(this.tokens, leftHandSide.Tokens.First, this.tokens.Last);

                // Create and return the expression.
                expression = new IncrementExpression(partialTokens, leftHandSide, IncrementExpression.IncrementType.Postfix);
            }

            return expression;
        }