private static Expression ReadBlock(XmlExpressionReader reader)
        {
            ParameterExpression[] vars = null;
            reader.PushScope();
            var exprs = reader.ReadChildExpressions(out vars);

            reader.PopScope();
            return(Block(vars, exprs));
        }
        private static Expression ReadMethodCall(XmlExpressionReader reader)
        {
            string     methodName = reader.ReadAttributeValue("method", null);
            Expression callExpr;

            reader.PushScope();

            var exprs = reader.ReadChildExpressions();

            if (exprs == null || exprs.Length == 0)
            {
                throw new MissingNodeException(reader.Node, null);
            }

            if (string.IsNullOrEmpty(methodName))
            {
                Type returnType = exprs[0].ValueType;
                //function
                callExpr = Call(exprs[0], returnType, exprs.Skip(1));
            }
            else
            {
                Type       type     = reader.ReadAttributeValue <Type>("type", null);
                Type[]     argTypes = ReadTypes(reader.ReadAttributeValue("argTypes", null));
                Expression instance = exprs[0];
                //if (instance == Null)
                //    instance = null;
                //if (instance != null)
                //{
                callExpr = Call(instance, type ?? instance.ValueType, methodName, argTypes, exprs.Skip(1));
                //}
                //else
                //{
                //    callExpr = Call(type, methodName, argTypes, exprs.Skip(1));
                //}
            }

            reader.PopScope();
            return(callExpr);
        }