IMethodSignatureMember IGenericParamParent <IMethodSignatureGenericTypeParameterMember, IMethodSignatureMember> .MakeGenericClosure(IControlledTypeCollection typeParameters) { return(this.MakeGenericClosure(typeParameters)); }
public _DummyEnumType MakeGenericClosure(IControlledTypeCollection typeParameters) { throw new InvalidOperationException(Resources.MakeGenericTypeError_IsGenericTypeDefFalse); }
internal _MethodSignatureMemberBase(TSignature original, IControlledTypeCollection genericReplacements) : base(original, genericReplacements) { }
public void UnregisterGenericMethod(IControlledTypeCollection typeParameters) { this.CheckGenericCache(); this.genericCache.UnregisterGenericMethod(typeParameters); }
internal _DelegateTypeBase(IDelegateType original, IControlledTypeCollection genericParameters) : base(original, genericParameters) { }
public _GlobalMethodMember(IModuleGlobalMethod original, IControlledTypeCollection genericReplacements) : base(original, genericReplacements) { }
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)); }
internal _ClassTypeBase(IClassType original, IControlledTypeCollection genericParameters) : base(original, genericParameters) { }
public ExpressionToCommaTypeReferenceFusionExpression(IFusionTypeCollectionTargetExpression target, IControlledTypeCollection terms) { this.Left = target; this.Right.AddRange(terms); }
IGenericParamParent IGenericParamParent.MakeGenericClosure(IControlledTypeCollection typeParameters) { return(this.MakeGenericClosure(typeParameters)); }
internal _InterfaceTypeBase(IInterfaceType original, IControlledTypeCollection genericParameters) : base(original, genericParameters) { }
protected abstract TMethod OnMakeGenericMethod(IControlledTypeCollection genericReplacements);
internal _MethodMemberBase(TMethod original, IControlledTypeCollection genericParameters) : base(original, genericParameters) { }
/// <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); }
protected override ITopLevelMethodMember OnMakeGenericMethod(IControlledTypeCollection genericReplacements) { return(new _TopLevelMethod(this, genericReplacements)); }
protected override IStructMethodMember OnMakeGenericMethod(IControlledTypeCollection genericReplacements) { return(new _StructTypeBase._MethodsBase._Method(this, genericReplacements)); }
internal _Method(IStructMethodMember original, IControlledTypeCollection genericParameters) : base(original, genericParameters) { }
protected override IModuleGlobalMethod OnMakeGenericMethod(IControlledTypeCollection genericReplacements) { throw new NotSupportedException("Closed generic global methods are already generic methods."); }
protected _GenericInstantiableTypeBase(TType original, IControlledTypeCollection genericParameters) : base(original, genericParameters) { }
protected override IDelegateType OnMakeGenericClosure(IControlledTypeCollection typeParameters) { return(new _DelegateTypeBase(this, typeParameters)); }
internal static bool ContainsGenericParameters(this IControlledTypeCollection collection) { return(collection.Any(current => current.ContainsGenericParameters())); }
protected override bool ContainsGenericMethod(IControlledTypeCollection typeParameters, ref TSignature r) { this.CheckGenericCache(); return(this.genericCache.ContainsGenericMethod(typeParameters, ref r)); }
internal static bool ContainsGenericParameters(this IControlledTypeCollection collection, Predicate <IType> furtherRestriction) { return(collection.Any(current => current.ContainsGenericParameters(furtherRestriction))); }
IGenericType IGenericType.MakeGenericClosure(IControlledTypeCollection typeParameters) { return this.MakeGenericClosure(typeParameters); }
internal static IType GetFirstGenericParameter(this IControlledTypeCollection collection, Predicate <IType> furtherRestriction) { return(collection.Where(current => current.ContainsGenericParameters(furtherRestriction)).Select(current => current.GetFirstGenericParameter(furtherRestriction)).FirstOrDefault()); }
IGenericParamParent IGenericParamParent.MakeGenericClosure(IControlledTypeCollection typeParameters) { throw new InvalidOperationException(Resources.MakeGenericTypeError_IsGenericTypeDefFalse); }
internal static bool ContainsSymbols(this IControlledTypeCollection collection) { return(collection.Any(current => current.ContainsSymbols())); }
public void RegisterGenericMethod(IMethodSignatureMember targetSignature, IControlledTypeCollection typeParameters) { this.CheckGenericCache(); this.genericCache.RegisterGenericMethod(targetSignature, typeParameters); }
public abstract TSignature MakeGenericClosure(IControlledTypeCollection genericReplacements);