/// <summary>
 /// Gets the reduced expression.
 /// </summary>
 /// <param name="expressionRewriter">The expression rewriter.</param>
 /// <returns>
 /// A <see cref="Expression" />.
 /// </returns>
 public Expression GetReducedExpression(IExpressionRewriter expressionRewriter)
 {
     return(expressionRewriter.Rewrite(
                this.expression,
                this.reduceByBaseUnit,
                this.FlatRepresentation.GetConsumer()));
 }
 /// <summary>
 /// Gets the reduced expression.
 /// </summary>
 /// <param name="expressionRewriter">The expression rewriter.</param>
 /// <returns>
 /// A <see cref="Expression" />.
 /// </returns>
 public Expression GetReducedExpression(IExpressionRewriter expressionRewriter)
 {
     return expressionRewriter.Rewrite(
         this.expression,
         this.reduceByBaseUnit,
         this.FlatRepresentation.GetConsumer());
 }
Example #3
0
        /// <summary>
        /// Rewrites the expression specified by <paramref name="expression"/>
        /// with the rewriter specified by <paramref name="rewriter"/>.
        /// </summary>
        /// <typeparam name="TType">
        /// Specifies the parameter type in the expression.
        /// </typeparam>
        /// <param name="expression">
        /// Specifies the expression.
        /// </param>
        /// <param name="rewriter">
        /// Specifies the rewriter.
        /// </param>
        /// <returns>
        /// The converted expression.
        /// </returns>
        public static Expression <Action <TType> > RewriteUsing <TType>(
            this Expression <Action <TType> > expression,
            IExpressionRewriter rewriter)
        {
            Guard.AgainstArgumentNull(expression, "expression");
            Guard.AgainstArgumentNull(rewriter, "rewriter");

            return(rewriter.Rewrite(expression) as Expression <Action <TType> >);
        }
 public ExpressionRewriterTester(Expression expression, IExpressionRewriter transformer)
 {
     _original = expression;
     _rewritten = transformer.Rewrite(expression);
 }