Exemplo n.º 1
0
        protected internal override ExpressionSlim VisitConstant(ConstantExpressionSlim node)
        {
            Append("Constant(");
            Append(node.Value);
            Append(", ");
            Append(node.Type);
            Append(')');

            return(node);
        }
        /// <summary>
        /// Visits a constant expression slim tree node, produces a constant expression.
        /// </summary>
        /// <param name="node">Node to visit.</param>
        /// <returns>The constant expression represented by the expression slim node.</returns>
        protected override Expression MakeConstant(ConstantExpressionSlim node)
        {
            var type = MakeType(node.Type);

            var reduced = default(object);

            if (node.Value != null)
            {
                reduced = node.Value.Reduce(type);
            }

            return(_factory.Constant(reduced, type));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Visits a constant expression tree node.
 /// </summary>
 /// <param name="node">Node to visit.</param>
 /// <returns>Result of visiting the node.</returns>
 protected internal virtual ExpressionSlim VisitConstant(ConstantExpressionSlim node)
 {
     return(node);
 }