示例#1
0
 public InstanceMethodCallExpressionSlim3(ExpressionSlim @object, MethodInfoSlim method, ExpressionSlim arg0, ExpressionSlim arg1, ExpressionSlim arg2)
     : base(@object, method)
 {
     _arg0 = arg0;
     _arg1 = arg1;
     _arg2 = arg2;
 }
示例#2
0
 public StaticMethodCallExpressionSlim3(MethodInfoSlim method, ExpressionSlim arg0, ExpressionSlim arg1, ExpressionSlim arg2)
     : base(method)
 {
     _arg0 = arg0;
     _arg1 = arg1;
     _arg2 = arg2;
 }
示例#3
0
 protected MethodDef(TypeRef declaringType, MethodInfoSlim method, TypeRef returnType, params TypeRef[] parameters)
     : base(declaringType)
 {
     Method     = method;
     ReturnType = returnType;
     Parameters = parameters;
 }
示例#4
0
 internal FullBinaryExpressionSlim(ExpressionType nodeType, ExpressionSlim left, ExpressionSlim right, bool liftToNull, MethodInfoSlim method, LambdaExpressionSlim conversion)
     : base(nodeType, left, right)
 {
     IsLiftedToNull = liftToNull;
     Method         = method;
     Conversion     = conversion;
 }
示例#5
0
        public static MethodCallExpressionSlim Call(MethodInfoSlim method, ExpressionSlim arg0)
        {
            Require(method, nameof(method));
            Require(arg0, nameof(arg0));

            return(new StaticMethodCallExpressionSlim1(method, arg0));
        }
 internal SwitchExpressionSlim(TypeSlim type, ExpressionSlim switchValue, ExpressionSlim defaultBody, MethodInfoSlim comparison, ReadOnlyCollection <SwitchCaseSlim> cases)
 {
     Type        = type;
     SwitchValue = switchValue;
     DefaultBody = defaultBody;
     Comparison  = comparison;
     Cases       = cases;
 }
示例#7
0
 public static ReadOnlyCollection <TypeSlim> GetGenericArguments(this MethodInfoSlim method)
 {
     return(method switch
     {
         GenericMethodInfoSlim gen => gen.GenericArguments,
         GenericDefinitionMethodInfoSlim def => def.GenericParameterTypes,
         _ => throw new InvalidOperationException(),
     });
示例#8
0
 public StaticMethodCallExpressionSlim5(MethodInfoSlim method, ExpressionSlim arg0, ExpressionSlim arg1, ExpressionSlim arg2, ExpressionSlim arg3, ExpressionSlim arg4)
     : base(method)
 {
     _arg0 = arg0;
     _arg1 = arg1;
     _arg2 = arg2;
     _arg3 = arg3;
     _arg4 = arg4;
 }
示例#9
0
 private MemberDef AddMethod(TypeRef declaringTypeRef, MethodInfoSlim method)
 {
     return(method.Kind switch
     {
         MethodInfoSlimKind.Simple => AddSimpleMethod(declaringTypeRef, (SimpleMethodInfoSlim)method),
         MethodInfoSlimKind.GenericDefinition => AddGenericDefinitionMethod(declaringTypeRef, (GenericDefinitionMethodInfoSlim)method),
         MethodInfoSlimKind.Generic => AddGenericMethod((GenericMethodInfoSlim)method),
         _ => throw new NotImplementedException(),
     });
示例#10
0
 public InstanceMethodCallExpressionSlim5(ExpressionSlim @object, MethodInfoSlim method, ExpressionSlim arg0, ExpressionSlim arg1, ExpressionSlim arg2, ExpressionSlim arg3, ExpressionSlim arg4)
     : base(@object, method)
 {
     _arg0 = arg0;
     _arg1 = arg1;
     _arg2 = arg2;
     _arg3 = arg3;
     _arg4 = arg4;
 }
示例#11
0
        public static MethodCallExpressionSlim Call(MethodInfoSlim method, ExpressionSlim arg0, ExpressionSlim arg1, ExpressionSlim arg2, ExpressionSlim arg3)
        {
            Require(method, nameof(method));
            Require(arg0, nameof(arg0));
            Require(arg1, nameof(arg1));
            Require(arg2, nameof(arg2));
            Require(arg3, nameof(arg3));

            return(new StaticMethodCallExpressionSlim4(method, arg0, arg1, arg2, arg3));
        }
示例#12
0
 public static MethodCallExpressionSlim Call(ExpressionSlim instance, MethodInfoSlim method, ExpressionSlim arg0, ExpressionSlim arg1, ExpressionSlim arg2, ExpressionSlim arg3, ExpressionSlim arg4)
 {
     if (instance == null)
     {
         return(new StaticMethodCallExpressionSlim5(method, arg0, arg1, arg2, arg3, arg4));
     }
     else
     {
         return(new InstanceMethodCallExpressionSlim5(instance, method, arg0, arg1, arg2, arg3, arg4));
     }
 }
示例#13
0
 public static MethodCallExpressionSlim Call(ExpressionSlim instance, MethodInfoSlim method, ExpressionSlim arg0)
 {
     if (instance == null)
     {
         return(new StaticMethodCallExpressionSlim1(method, arg0));
     }
     else
     {
         return(new InstanceMethodCallExpressionSlim1(instance, method, arg0));
     }
 }
示例#14
0
        public static MethodCallExpressionSlim Call(ExpressionSlim instance, MethodInfoSlim method)
        {
            Require(method, nameof(method));

            if (instance == null)
            {
                return(new StaticMethodCallExpressionSlim0(method));
            }
            else
            {
                return(new InstanceMethodCallExpressionSlim0(instance, method));
            }
        }
示例#15
0
        public static MethodCallExpressionSlim Call(ExpressionSlim instance, MethodInfoSlim method, ExpressionSlim arg0, ExpressionSlim arg1)
        {
            Require(method, nameof(method));
            Require(arg0, nameof(arg0));
            Require(arg1, nameof(arg1));

            if (instance == null)
            {
                return(new StaticMethodCallExpressionSlim2(method, arg0, arg1));
            }
            else
            {
                return(new InstanceMethodCallExpressionSlim2(instance, method, arg0, arg1));
            }
        }
示例#16
0
        private static void AssertAreSameMethod(MethodInfo methodInfo, MethodInfoSlim methodInfoSlim)
        {
            Assert.IsTrue(TypeSlimExtensions.Equals(methodInfo.ReturnType.ToTypeSlim(), methodInfoSlim.ReturnType));
            Assert.IsTrue(methodInfoSlim.ParameterTypes.SequenceEqual(methodInfo.GetParameters().Select(p => p.ParameterType.ToTypeSlim())));

            switch (methodInfoSlim.Kind)
            {
            case MethodInfoSlimKind.Simple:
                AssertAreSameSimpleMethod(methodInfo, (SimpleMethodInfoSlim)methodInfoSlim);
                return;

            case MethodInfoSlimKind.GenericDefinition:
                Assert.IsTrue(methodInfo.IsGenericMethodDefinition);
                AssertAreSameGenericDefinitionMethod(methodInfo, (GenericDefinitionMethodInfoSlim)methodInfoSlim);
                return;

            case MethodInfoSlimKind.Generic:
                AssertAreSameGenericMethod(methodInfo, (GenericMethodInfoSlim)methodInfoSlim);
                return;
            }

            Fail(methodInfo, methodInfoSlim);
        }
示例#17
0
 internal MethodBasedNonLiftedBinaryExpressionSlim(ExpressionType nodeType, ExpressionSlim left, ExpressionSlim right, MethodInfoSlim method)
     : base(nodeType, left, right)
 {
     Method = method;
 }
示例#18
0
 public InstanceMethodCallExpressionSlim1(ExpressionSlim @object, MethodInfoSlim method, ExpressionSlim arg0)
     : base(@object, method)
 {
     _arg0 = arg0;
 }
示例#19
0
 internal MethodBasedTypedUnaryExpressionSlim(ExpressionType nodeType, ExpressionSlim operand, TypeSlim type, MethodInfoSlim method)
     : base(nodeType, operand, type)
 {
     Method = method;
 }
示例#20
0
 public static MethodCallExpressionSlim Call(MethodInfoSlim method, ExpressionSlim arg0, ExpressionSlim arg1, ExpressionSlim arg2, ExpressionSlim arg3, ExpressionSlim arg4)
 {
     return(new StaticMethodCallExpressionSlim5(method, arg0, arg1, arg2, arg3, arg4));
 }
示例#21
0
#pragma warning restore CA1062
#pragma warning restore IDE0079

        internal static BinaryExpressionSlim Make(ExpressionType nodeType, ExpressionSlim left, ExpressionSlim right, bool liftToNull, MethodInfoSlim method, LambdaExpressionSlim conversion)
        {
            if (conversion == null)
            {
                if (liftToNull)
                {
                    if (method == null)
                    {
                        return(new LiftedBinaryExpressionSlim(nodeType, left, right));
                    }
                    else
                    {
                        return(new MethodBasedLiftedBinaryExpressionSlim(nodeType, left, right, method));
                    }
                }
                else
                {
                    if (method == null)
                    {
                        return(new NonLiftedBinaryExpressionSlim(nodeType, left, right));
                    }
                    else
                    {
                        return(new MethodBasedNonLiftedBinaryExpressionSlim(nodeType, left, right, method));
                    }
                }
            }

            return(new FullBinaryExpressionSlim(nodeType, left, right, liftToNull, method, conversion));
        }
示例#22
0
 internal ElementInitSlim(MethodInfoSlim addMethod, ReadOnlyCollection <ExpressionSlim> arguments)
 {
     AddMethod = addMethod;
     Arguments = arguments;
 }
示例#23
0
 public StaticMethodCallExpressionSlim2(MethodInfoSlim method, ExpressionSlim arg0, ExpressionSlim arg1)
     : base(method)
 {
     _arg0 = arg0;
     _arg1 = arg1;
 }
示例#24
0
 public static MethodCallExpressionSlim Call(MethodInfoSlim method)
 {
     return(new StaticMethodCallExpressionSlim0(method));
 }
示例#25
0
 public static MethodCallExpressionSlim Call(MethodInfoSlim method, ExpressionSlim arg0, ExpressionSlim arg1)
 {
     return(new StaticMethodCallExpressionSlim2(method, arg0, arg1));
 }
示例#26
0
 public StaticMethodCallExpressionSlim1(MethodInfoSlim method, ExpressionSlim arg0)
     : base(method)
 {
     _arg0 = arg0;
 }
示例#27
0
#pragma warning restore CA1062
#pragma warning restore IDE0079

        internal static UnaryExpressionSlim Make(ExpressionType nodeType, ExpressionSlim operand, MethodInfoSlim method, TypeSlim type)
        {
            if (type == s_typeMissing)
            {
                if (method == null)
                {
                    return(new UntypedUnaryExpressionSlim(nodeType, operand));
                }
                else
                {
                    return(new MethodBasedUntypedUnaryExpressionSlim(nodeType, operand, method));
                }
            }
            else
            {
                if (method == null)
                {
                    return(new TypedUnaryExpressionSlim(nodeType, operand, type));
                }
                else
                {
                    return(new MethodBasedTypedUnaryExpressionSlim(nodeType, operand, type, method));
                }
            }
        }
示例#28
0
        public static MethodCallExpressionSlim Call(MethodInfoSlim method)
        {
            Require(method, nameof(method));

            return(new StaticMethodCallExpressionSlim0(method));
        }
#pragma warning disable IDE0079 // Remove unnecessary suppression.

        internal MethodCallExpressionSlim(MethodInfoSlim method)
        {
            Method = method;
        }
示例#30
0
        public static ReadOnlyCollection <TypeSlim> GetGenericArguments(this MethodInfoSlim m)
        {
            var g = (GenericMethodInfoSlim)m;

            return(g.GenericArguments);
        }