private static IndirectMethodSpecialization InitializeInstance(IndirectMethodSpecialization instance)
        {
            instance.genericParameterCache = new Lazy <IReadOnlyList <IGenericParameter> >(
                instance.CreateGenericParameters);

            MethodSpecialization.InitializeInstance(instance);
            instance.qualName = instance.Declaration.Name.Qualify(
                instance.parentTy.FullName);

            return(instance);
        }
        /// <summary>
        /// Initializes a method specialization instance.
        /// </summary>
        /// <param name="instance">The instance to initialize.</param>
        /// <returns><paramref name="instance"/> itself.</returns>
        protected static MethodSpecialization InitializeInstance(MethodSpecialization instance)
        {
            instance.InstantiatingVisitor = new TypeMappingVisitor(
                TypeExtensions.GetRecursiveGenericArgumentMapping(instance));

            instance.ReturnParameter = instance.InstantiatingVisitor.Visit(
                instance.Declaration.ReturnParameter);
            instance.parameterCache = new Lazy <IReadOnlyList <Parameter> >(
                instance.CreateParameters);
            instance.baseMethodCache = new Lazy <IReadOnlyList <IMethod> >(
                instance.CreateBaseMethods);

            return(instance);
        }
        private static DirectMethodSpecialization InitializeInstance(DirectMethodSpecialization instance)
        {
            var genericArguments   = instance.GenericArguments;
            var simpleTypeArgNames = new QualifiedName[genericArguments.Count];
            var qualTypeArgNames   = new QualifiedName[simpleTypeArgNames.Length];

            for (int i = 0; i < qualTypeArgNames.Length; i++)
            {
                simpleTypeArgNames[i] = genericArguments[i].Name.Qualify();
                qualTypeArgNames[i]   = genericArguments[i].FullName;
            }

            instance.unqualName = new GenericName(instance.Declaration.Name, simpleTypeArgNames);
            instance.qualName   = new GenericName(instance.Declaration.FullName, qualTypeArgNames).Qualify();

            MethodSpecialization.InitializeInstance(instance);

            return(instance);
        }