Beispiel #1
0
        public static T ChangeOperands <T>(this T expression, IList <Expression> operands, IEnumerable <Expression> oldOperands = null)
            where T : Expression
        {
            if (!HaveOperandsChanged(operands, oldOperands))
            {
                return(expression);
            }
            var mutableExpression = expression as IMutableExpression;

            if (mutableExpression != null)
            {
                return((T)mutableExpression.Mutate(operands));
            }
            // RI: new version
            var result = (T)ExpressionMutator.Mutate(expression, operands);

            return(result);
            // return (T)ExpressionMutatorFactory.GetMutator(expression).Mutate(operands);
        }
Beispiel #2
0
        /// <summary>
        /// Enumerates all subexpressions related to this one
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        public static IList <Expression> GetOperands(this Expression expression)
        {
            var result = ExpressionMutator.GetOperands(expression);

            return(result);
        }