示例#1
0
        public FieldProxy(IType instance, IField field)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }
            if (field == null)
            {
                throw new ArgumentNullException("field");
            }

            _instance = instance;
            _field    = field;
            _type     = GenericType.Resolve(instance, field.Type);
        }
示例#2
0
 public static IMethod FindOverrideMethod(this IType type, IMethod method)
 {
     if (method.IsGenericInstance)
     {
         var gm = method.InstanceOf;
         var m  = type.FindSameMethod(gm, false);
         if (m == null)
         {
             return(null);
         }
         m = GenericType.CreateMethodInstance(type, m, method.GenericArguments);
         if (m == null)
         {
             throw new InvalidOperationException();
         }
         return(m);
     }
     return(type.FindSameMethod(method, false));
 }
示例#3
0
        private IMethod ResolveMethod(IMethod method)
        {
            if (method == null)
            {
                return(null);
            }
            var declType = GenericType.Resolve(_instance, this, method.DeclaringType);

            if (declType.IsGenericInstance())
            {
                var m = GenericType.FindMethodProxy(declType, method);
                if (m == null)
                {
                    throw new InvalidOperationException();
                }
                return(m);
            }
            return(method);
        }
示例#4
0
 private IEnumerable <IParameter> Populate()
 {
     return(_source.Select(p => (IParameter) new ParameterProxy(p, GenericType.Resolve(_contextType, _contextMethod, p.Type))));
 }