protected override Expression VisitMethodCall(MethodCallExpression mc)
 {
     if (mc.AsTupleAccess() != null)
     {
         var sourceIndex = mc.GetTupleAccessArgument();
         if (mc.GetApplyParameter() != null)
         {
             return(Expression.Call(leftTupleParameter, mc.Method, mc.Arguments[0]));
         }
         var name         = sourceColumns.Single(column => column.Index == sourceIndex).Name;
         var currentIndex = targetColumns[name].Index;
         return(Expression.Call(mc.Object, mc.Method, Expression.Constant(currentIndex)));
     }
     return(base.VisitMethodCall(mc));
 }
        protected override SqlExpression VisitMethodCall(MethodCallExpression mc)
        {
            if (mc.AsTupleAccess(activeParameters) != null)
            {
                return(VisitTupleAccess(mc));
            }

            var arguments = mc.Arguments.Select(a => Visit(a)).ToArray();
            var mi        = mc.Method;

            if (mc.Object != null && mc.Object.Type != mi.ReflectedType)
            {
                mi = mc.Object.Type.GetMethod(mi.Name, mi.GetParameterTypes());
            }

            return(CompileMember(mi, Visit(mc.Object), arguments));
        }
 protected override Expression VisitMethodCall(MethodCallExpression mc)
 {
     if (mc.AsTupleAccess() != null)
     {
         var applyParameter = mc.GetApplyParameter();
         if (result == null)
         {
             result = applyParameter;
         }
         else if (applyParameter != null && result != applyParameter)
         {
             throw new InvalidOperationException(Strings.ExPredicateContainsAccessesToDifferentApplyParameters);
         }
         return(mc);
     }
     return(base.VisitMethodCall(mc));
 }
        protected override Expression VisitMethodCall(MethodCallExpression mc)
        {
            var tupleAccess = mc.AsTupleAccess();

            if (tupleAccess == null)
            {
                return(base.VisitMethodCall(mc));
            }
            var memberExpression = tupleAccess.Object as MemberExpression;

            if (memberExpression != null &&
                memberExpression.Member == WellKnownMembers.ApplyParameterValue &&
                memberExpression.Expression.NodeType == ExpressionType.Constant &&
                ((ConstantExpression)memberExpression.Expression).Value == applyParameter)
            {
                var index = (int)((ConstantExpression)tupleAccess.Arguments[0]).Value;
                return(processor.Invoke(mc, index));
            }
            return(base.VisitMethodCall(mc));
        }