protected virtual void AppendGenericMethodWithTypeArguments(StringBuilder builder, AstGenericMethodWithTypeArguments genericMethodWithTypeArguments)
 {
     builder.Append(genericMethodWithTypeArguments);
 }
示例#2
0
        private Tuple<IAstMethodReference, int> GetOrMakeMatch(IAstMethodReference method, IEnumerable<IAstTypeReference> parameterTypes, IEnumerable<IAstTypeReference> argumentTypes)
        {
            var genericTheories = new Dictionary<IAstTypeReference, ISet<IAstTypeReference>>();
            var distance = GetDistanceForAll(method, parameterTypes, argumentTypes, genericTheories);
            if (distance == -1)
                return null;

            if (method.IsGeneric) {
                var genericParameters = method.GetGenericParameterTypes().ToArray();
                var genericArguments = new IAstTypeReference[genericParameters.Length];
                for (var i = 0; i < genericParameters.Length; i++) {
                    var theories = genericTheories.GetValueOrDefault(genericParameters[i]);
                    if (theories == null)
                        return null;

                    var aggregate = ReconcileGenericTheories(theories, method);
                    if (aggregate == null)
                        return null;

                    genericArguments[i] = aggregate;
                }

                var generic = new AstGenericMethodWithTypeArguments(method, genericArguments, this.genericHelper);
                return Tuple.Create((IAstMethodReference)generic, distance);
            }

            return Tuple.Create(method, distance);
        }