Exemplo n.º 1
0
        protected override Expression VisitUnary(UnaryExpression node)
        {
            // For OpAssign nodes: if has a yield, we need to do the generator
            // transformation on the reduced value.
            if (node.CanReduce)
            {
                return(Visit(node.Reduce()));
            }

            int        yields = _yields.Count;
            Expression o      = Visit(node.Operand);

            if (o == node.Operand)
            {
                return(node);
            }
            if (yields == _yields.Count)
            {
                return(Expression.MakeUnary(node.NodeType, o, node.Type, node.Method));
            }
            return(Expression.Block(
                       ToTemp(ref o),
                       Expression.MakeUnary(node.NodeType, o, node.Type, node.Method)
                       ));
        }
Exemplo n.º 2
0
        protected override Expression VisitUnary(UnaryExpression node)
        {
            // For OpAssign nodes: if has a yield, we need to do the generator
            // transformation on the reduced value.
            if (node.CanReduce)
            {
                return(Visit(node.Reduce()));
            }

            return(Rewrite(node, node.Operand, node.Update));
        }