示例#1
0
        static NewExpression MutateNew(NewExpression node, IList <Expression> operands)
        {
            Type[] types = node.Members == null?node.Constructor.GetParameters().Select(p => p.ParameterType).ToArray()
                               : node.Members.Select(m => m.GetMemberType()).ToArray();

            for (int i = 0; i < operands.Count; i++)
            {
                operands[i] = ExpressionUtil.CheckNeedConvert(operands[i], types[i]);
            }
            return(node.Update(operands));
        }
示例#2
0
        public static BinaryExpression MakeGreaterThanZero(Expression expr)
        {
            var zeroExpr = ExpressionUtil.MakeZero(expr.Type);

            return(Expression.GreaterThan(expr, zeroExpr));
        }
示例#3
0
 static BinaryExpression MutateBinary(BinaryExpression node, IList <Expression> operands)
 {
     // After replacing arguments with column expressions there might be a problem with nullable columns.
     // The following code compensates for this
     return(ExpressionUtil.MakeBinary(node.NodeType, operands[0], operands[1]));
 }