public AstGenericMethodWithTypeArguments(IAstMethodReference actual, IList<IAstTypeReference> typeArguments, GenericTypeHelper genericHelper)
        {
            Argument.RequireNotNull("actual", actual);
            Argument.RequireNotNull("typeArguments", typeArguments);

            this.Actual = actual;
            this.GenericArgumentTypes = typeArguments.AsReadOnly();

            var genericParameterTypes = actual.GetGenericParameterTypes().ToArray();
            this.ParameterTypes = actual.ParameterTypes.Select(t => ApplyArgumentTypes(genericHelper, t, genericParameterTypes)).ToArray().AsReadOnly();
            this.ReturnType = ApplyArgumentTypes(genericHelper, actual.ReturnType, genericParameterTypes);
        }
예제 #2
0
 public MethodCallResolver(GenericTypeHelper genericHelper)
 {
     this.genericHelper = genericHelper;
 }
        private IAstTypeReference ApplyArgumentTypes(GenericTypeHelper genericHelper, IAstTypeReference type, IAstTypeReference[] genericParameterTypes)
        {
            return genericHelper.RemapArgumentTypes(type, t => {
                var parameterIndex = genericParameterTypes.IndexOf(t);
                if (parameterIndex < 0)
                    return t;

                return this.GenericArgumentTypes[parameterIndex];
            });
        }
예제 #4
0
 public MethodCallResolver(GenericTypeHelper genericHelper)
 {
     this.genericHelper = genericHelper;
 }