Example #1
0
        protected internal override ExpressionSlim VisitUnary(UnaryExpressionSlim node)
        {
            // CONSIDER: Method has been historically omitted here. We can consider adding it later.

            Append(node.NodeType);
            Append('(');

            if (node.Operand != null)
            {
                Visit(node.Operand);

                if (node.Type != null)
                {
                    Append(", ");
                }
            }

            if (node.Type != null)
            {
                Append(node.Type);
            }

            Append(')');

            return(node);
        }
Example #2
0
        /// <summary>
        /// Creates a new expression that is like this one, but using the supplied children. If all of the children are the same, it will return this expression.
        /// </summary>
        /// <param name="operand">The <see cref="Operand"/> child node of the result.</param>
        /// <returns>This expression if no children are changed or an expression with the updated children.</returns>
        public UnaryExpressionSlim Update(ExpressionSlim operand)
        {
            if (operand == Operand)
            {
                return(this);
            }

            return(UnaryExpressionSlim.Make(NodeType, operand, Method, Type));
        }
 /// <summary>
 /// Visits a unary expression tree node.
 /// </summary>
 /// <param name="node">Node to visit.</param>
 /// <returns>Result of visiting the node.</returns>
 protected internal virtual ExpressionSlim VisitUnary(UnaryExpressionSlim node)
 {
     return(node.Update(Visit(node.Operand)));
 }