示例#1
0
        BoundExpression BindIncDec(AST.IncDecEx expr)
        {
            // bind variable reference
            var varref = (BoundReferenceExpression)BindExpression(expr.Variable, BoundAccess.ReadAndWrite);

            // resolve kind
            UnaryOperationKind kind;

            if (expr.Inc)
            {
                kind = (expr.Post) ? UnaryOperationKind.OperatorPostfixIncrement : UnaryOperationKind.OperatorPrefixIncrement;
            }
            else
            {
                kind = (expr.Post) ? UnaryOperationKind.OperatorPostfixDecrement : UnaryOperationKind.OperatorPrefixDecrement;
            }

            //
            return(new BoundIncDecEx(varref, kind));
        }
示例#2
0
 /// <summary>
 /// Visit variable that is incremented (or decremented).
 /// </summary>
 /// <param name="x"></param>
 virtual public void VisitIncDecEx(IncDecEx x)
 {
     VisitElement(x.Variable);
 }