public MethodInterpreterKey(MethodInterpreter interpreter, Type implementingType = null)
        {
            _interpreter = interpreter;
            var methodBase = _interpreter.Method;

            DeclaringType    = methodBase.DeclaringType;
            ImplementingType = implementingType ?? methodBase.DeclaringType;
            _methodName      = methodBase.Name;

            var parameterList = new List <Type>();

            if (!methodBase.IsStatic)
            {
                parameterList.Add(methodBase.DeclaringType);
            }
            parameterList.AddRange(methodBase.GetParameters().Select(par => par.ParameterType).ToList());
            var returnType = methodBase.GetReturnType();

            if (returnType != typeof(void))
            {
                parameterList.Add(returnType);
            }
            _parameterList = parameterList.ToArray();

            RecomputeHash();
        }
示例#2
0
        public MethodInterpreter Clone()
        {
            var result = new MethodInterpreter(Method)
            {
                MidRepresentation       = MidRepresentation,
                ClassSpecializationType = ClassSpecializationType,
                Kind = Kind,
                MethodSpecializationType = MethodSpecializationType
            };

            return(result);
        }
示例#3
0
        public static MethodInterpreterKey ToKey(this MethodInterpreter methodInterpreter, Type implementingType = null)
        {
            var result = new MethodInterpreterKey(methodInterpreter, implementingType);

            return(result);
        }