Пример #1
0
 IMethodSignatureMember IGenericParamParent <IMethodSignatureGenericTypeParameterMember, IMethodSignatureMember> .MakeGenericClosure(IControlledTypeCollection typeParameters)
 {
     return(this.MakeGenericClosure(typeParameters));
 }
Пример #2
0
 public _DummyEnumType MakeGenericClosure(IControlledTypeCollection typeParameters)
 {
     throw new InvalidOperationException(Resources.MakeGenericTypeError_IsGenericTypeDefFalse);
 }
Пример #3
0
 internal _MethodSignatureMemberBase(TSignature original, IControlledTypeCollection genericReplacements)
     : base(original, genericReplacements)
 {
 }
Пример #4
0
 public void UnregisterGenericMethod(IControlledTypeCollection typeParameters)
 {
     this.CheckGenericCache();
     this.genericCache.UnregisterGenericMethod(typeParameters);
 }
Пример #5
0
 internal _DelegateTypeBase(IDelegateType original, IControlledTypeCollection genericParameters)
     : base(original, genericParameters)
 {
 }
Пример #6
0
 public _GlobalMethodMember(IModuleGlobalMethod original, IControlledTypeCollection genericReplacements)
     : base(original, genericReplacements)
 {
 }
Пример #7
0
 protected override sealed IInterfaceMethodMember OnMakeGenericMethod(IControlledTypeCollection genericReplacements)
 {
     throw new InvalidOperationException();
 }
 protected override IGenericParameterMethodMember <TGenericParameter> OnMakeGenericMethod(IControlledTypeCollection genericReplacements)
 {
     return(new _Internal.GenericLayer.Members._GenericParameterMethodMemberBase <TGenericParameter>(this, genericReplacements));
 }
Пример #9
0
 internal _ClassTypeBase(IClassType original, IControlledTypeCollection genericParameters)
     : base(original, genericParameters)
 {
 }
 public ExpressionToCommaTypeReferenceFusionExpression(IFusionTypeCollectionTargetExpression target, IControlledTypeCollection terms)
 {
     this.Left = target;
     this.Right.AddRange(terms);
 }
Пример #11
0
 IGenericParamParent IGenericParamParent.MakeGenericClosure(IControlledTypeCollection typeParameters)
 {
     return(this.MakeGenericClosure(typeParameters));
 }
Пример #12
0
 internal _InterfaceTypeBase(IInterfaceType original, IControlledTypeCollection genericParameters)
     : base(original, genericParameters)
 {
 }
Пример #13
0
 protected abstract TMethod OnMakeGenericMethod(IControlledTypeCollection genericReplacements);
Пример #14
0
 internal _MethodMemberBase(TMethod original, IControlledTypeCollection genericParameters)
     : base(original, genericParameters)
 {
 }
Пример #15
0
        /// <summary>
        /// Resolves generic type-parameters contained within the
        /// <paramref name="target"/> <see cref="IType"/> by
        /// rebuilding the <paramref name="target"/> with
        /// the <paramref name="typeReplacements"/> used in place of
        /// the <see cref="IGenericTypeParameter"/> instances.
        /// </summary>
        /// <param name="target">The target <see cref="IType"/>
        /// to disambiguify.</param>
        /// <param name="methodReplacements">The <see cref="IType"/>
        /// series which contains a series of types which is index-relative
        /// to the <paramref name="target"/>'s type-parameters.</param>
        /// <param name="typeReplacements">The <see cref="IType"/>
        /// series which contains a series of types that is index-relative
        /// to the <paramref name="target"/>'s type-parameters.</param>
        /// <param name="parameterSource">The point to source
        /// the replacements from.</param>
        /// <returns>A <see cref="IType"/> instance which has been disambiguified
        /// by replacing the type-parameters in the present context with the
        /// type-replacements in the disambiguated context.</returns>
        /// <exception cref="System.ArgumentNullException">When <paramref name="typeReplacements"/> is
        /// null and <paramref name="parameterSource"/> contains the <see cref="TypeParameterSources.Type"/>
        /// flag, or when <paramref name="methodReplacements"/> is null and
        /// <paramref name="parameterSource"/> contains the <see cref="TypeParameterSources.Method"/>
        /// flag.</exception>
        public static IType Disambiguify(this IType target, IControlledTypeCollection typeReplacements, IControlledTypeCollection methodReplacements, TypeParameterSources parameterSource)
        {
            if (((parameterSource & TypeParameterSources.Type) == TypeParameterSources.Type) &&
                typeReplacements == null)
            {
                throw new ArgumentNullException("typeReplacements");
            }
            if (((parameterSource & TypeParameterSources.Method) == TypeParameterSources.Method) &&
                methodReplacements == null)
            {
                throw new ArgumentNullException("methodReplacements");
            }

            /* *
             * Assumes a great deal in that: Types provided are used in scope.
             * Beyond scope this does not work as intended since the positions
             * of out-of-scope type-parameters might not be relatively
             * equivalent to the scope they are used in (typeReplacements).
             * */
            if (target.IsGenericTypeParameter)
            {
                if (target is IGenericParameter)
                {
                    /* *
                     * If the declaring type is null, this method assumes
                     * it's a method.  Primarily to aid in possible other
                     * uses.
                     * */
                    if ((parameterSource & TypeParameterSources.Method) == TypeParameterSources.Method &&
                        ((IGenericParameter)(target)).Parent is IMethodSignatureMember &&
                        ((IGenericParameter)(target)).Position < methodReplacements.Count)
                    {
                        return(methodReplacements[((IGenericParameter)(target)).Position]);
                    }
                    if ((parameterSource & TypeParameterSources.Type) == TypeParameterSources.Type &&
                        ((IGenericParameter)(target)).Parent is IGenericType &&
                        ((IGenericParameter)(target)).Position < typeReplacements.Count)
                    {
                        return(typeReplacements[((IGenericParameter)(target)).Position]);
                    }
                }
            }
            else
            {
                switch (target.ElementClassification)
                {
                case TypeElementClassification.Array:
                    if (target is IArrayType)
                    {
                        return(target.ElementType.Disambiguify(typeReplacements, methodReplacements, parameterSource).MakeArray(((IArrayType)target).ArrayRank));
                    }
                    break;

                case TypeElementClassification.Nullable:
                    return(target.ElementType.Disambiguify(typeReplacements, methodReplacements, parameterSource).MakeNullable());

                case TypeElementClassification.Pointer:
                    return(target.ElementType.Disambiguify(typeReplacements, methodReplacements, parameterSource).MakePointer());

                case TypeElementClassification.Reference:
                    return(target.ElementType.Disambiguify(typeReplacements, methodReplacements, parameterSource).MakeByReference());

                case TypeElementClassification.GenericTypeDefinition:
                    if (target.ElementType is IGenericType)
                    {
                        return(((IGenericType)target.ElementType).MakeGenericClosure(((IGenericType)target).GenericParameters.OnAll(gP => gP.Disambiguify(typeReplacements, methodReplacements, parameterSource)).ToCollection()));
                    }
                    break;

                case TypeElementClassification.None:
                    if (target is IGenericType &&
                        (parameterSource == TypeParameterSources.Type && ((IGenericType)(target)).GenericParameters.Count == typeReplacements.Count) && target.IsGenericConstruct && typeReplacements.Count > 0)
                    {
                        return(((IGenericType)(target)).MakeGenericClosure(typeReplacements));
                    }

                    break;
                }
            }
            return(target);
        }
Пример #16
0
 protected override ITopLevelMethodMember OnMakeGenericMethod(IControlledTypeCollection genericReplacements)
 {
     return(new _TopLevelMethod(this, genericReplacements));
 }
Пример #17
0
 protected override IStructMethodMember OnMakeGenericMethod(IControlledTypeCollection genericReplacements)
 {
     return(new _StructTypeBase._MethodsBase._Method(this, genericReplacements));
 }
Пример #18
0
 internal _Method(IStructMethodMember original, IControlledTypeCollection genericParameters)
     : base(original, genericParameters)
 {
 }
Пример #19
0
 protected override IModuleGlobalMethod OnMakeGenericMethod(IControlledTypeCollection genericReplacements)
 {
     throw new NotSupportedException("Closed generic global methods are already generic methods.");
 }
Пример #20
0
 protected _GenericInstantiableTypeBase(TType original, IControlledTypeCollection genericParameters)
     : base(original, genericParameters)
 {
 }
Пример #21
0
 protected override IDelegateType OnMakeGenericClosure(IControlledTypeCollection typeParameters)
 {
     return(new _DelegateTypeBase(this, typeParameters));
 }
Пример #22
0
 internal static bool ContainsGenericParameters(this IControlledTypeCollection collection)
 {
     return(collection.Any(current => current.ContainsGenericParameters()));
 }
Пример #23
0
 protected override bool ContainsGenericMethod(IControlledTypeCollection typeParameters, ref TSignature r)
 {
     this.CheckGenericCache();
     return(this.genericCache.ContainsGenericMethod(typeParameters, ref r));
 }
Пример #24
0
 internal static bool ContainsGenericParameters(this IControlledTypeCollection collection, Predicate <IType> furtherRestriction)
 {
     return(collection.Any(current => current.ContainsGenericParameters(furtherRestriction)));
 }
Пример #25
0
 IGenericType IGenericType.MakeGenericClosure(IControlledTypeCollection typeParameters)
 {
     return this.MakeGenericClosure(typeParameters);
 }
Пример #26
0
 internal static IType GetFirstGenericParameter(this IControlledTypeCollection collection, Predicate <IType> furtherRestriction)
 {
     return(collection.Where(current => current.ContainsGenericParameters(furtherRestriction)).Select(current => current.GetFirstGenericParameter(furtherRestriction)).FirstOrDefault());
 }
Пример #27
0
 IGenericParamParent IGenericParamParent.MakeGenericClosure(IControlledTypeCollection typeParameters)
 {
     throw new InvalidOperationException(Resources.MakeGenericTypeError_IsGenericTypeDefFalse);
 }
Пример #28
0
 internal static bool ContainsSymbols(this IControlledTypeCollection collection)
 {
     return(collection.Any(current => current.ContainsSymbols()));
 }
Пример #29
0
 public void RegisterGenericMethod(IMethodSignatureMember targetSignature, IControlledTypeCollection typeParameters)
 {
     this.CheckGenericCache();
     this.genericCache.RegisterGenericMethod(targetSignature, typeParameters);
 }
Пример #30
0
 public abstract TSignature MakeGenericClosure(IControlledTypeCollection genericReplacements);