Пример #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));
        }
Пример #6
0
 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);
        }