src\runtime\src\coreclr\tools\Common\TypeSystem\Common\CastingHelper.cs (67)
15public static bool CanCastTo(this TypeDesc thisType, TypeDesc otherType)
26public static bool CanCastToWithCanon(this TypeDesc thisType, TypeDesc otherType)
31public static bool IsArrayElementTypeCastableBySize(TypeDesc elementType)
55private static TypeFlags GetReducedTypeElementType(TypeDesc type)
79private static TypeFlags GetVerificationTypeElementType(TypeDesc type)
97private static bool AreVerificationTypesEqual(TypeDesc type1, TypeDesc type2)
120private static bool IsMethodSignatureCompatibleWith(TypeDesc fn1Ttype, TypeDesc fn2Type)
130public static bool IsCompatibleWith(this TypeDesc thisType, TypeDesc otherType)
135internal static bool IsCompatibleWith(this TypeDesc thisType, TypeDesc otherType, StackOverflowProtect visited)
181public static bool IsEquivalentTo(this TypeDesc thisType, TypeDesc otherType)
190internal static bool IsEquivalentTo(this TypeDesc thisType, TypeDesc otherType, StackOverflowProtect visited)
199static partial void IsEquivalentTo(this TypeDesc thisType, TypeDesc otherType, StackOverflowProtect visited, ref bool isEquivalentTo);
204static abstract bool IsCanonicalCastTarget(TypeDesc thisType, TypeDesc otherType);
205static abstract bool IsCanonicalTypeArgMatch(TypeDesc type, TypeDesc otherType);
206static abstract bool IsCanonEquivalent(TypeDesc thisType, TypeDesc otherType);
212static bool ICanonicalTypeCastingHandler.IsCanonicalCastTarget(TypeDesc thisType, TypeDesc otherType) => false;
213static bool ICanonicalTypeCastingHandler.IsCanonicalTypeArgMatch(TypeDesc type, TypeDesc otherType) => false;
214static bool ICanonicalTypeCastingHandler.IsCanonEquivalent(TypeDesc thisType, TypeDesc otherType) => false;
219internal static bool CanCastToInternal(TypeDesc thisType, TypeDesc otherType, StackOverflowProtect protect)
257private static bool CanCastGenericParameterTo(GenericParameterDesc thisType, TypeDesc otherType, StackOverflowProtect protect)
280typeInstantiation = ((TypeDesc)thisType.AssociatedTypeOrMethod).Instantiation;
282foreach (var typeConstraint in thisType.TypeConstraints)
284TypeDesc instantiatedConstraint = typeConstraint.InstantiateSignature(typeInstantiation, methodInstantiation);
294private static bool CanCastArrayTo(ArrayType thisType, TypeDesc otherType, StackOverflowProtect protect)
327private static bool CanCastParamTo(ParameterizedType thisType, TypeDesc paramType, StackOverflowProtect protect)
338TypeDesc curTypesParm = thisType.ParameterType;
341TypeDesc fromParamUnderlyingType = curTypesParm.UnderlyingType;
356TypeDesc toParamUnderlyingType = paramType.UnderlyingType;
369foreach (var typeConstraint in type.TypeConstraints)
391private static TypeFlags GetNormalizedIntegralArrayElementType(TypeDesc type)
414private static bool CanCastToClassOrInterface(TypeDesc thisType, TypeDesc otherType, StackOverflowProtect protect)
426private static bool CanCastToInterface(TypeDesc thisType, TypeDesc otherType, StackOverflowProtect protect)
453private static bool CanCastToNonVariantInterface(TypeDesc thisType, TypeDesc otherType)
471private static bool CanCastByVarianceToInterfaceOrDelegate(TypeDesc thisType, TypeDesc otherType, StackOverflowProtect protectInput, bool arrayCovariance = false)
501TypeDesc arg = instantiationThis[i];
502TypeDesc targetArg = instantiationTarget[i];
535private static bool CanCastToClass(TypeDesc thisType, TypeDesc otherType, StackOverflowProtect protect)
537TypeDesc curType = thisType;
591private static bool IsBoxedAndCanCastTo(TypeDesc thisType, TypeDesc otherType, StackOverflowProtect protect, bool arrayCovariance)
593TypeDesc fromUnderlyingType = thisType.UnderlyingType;
609TypeDesc toUnderlyingType = otherType.UnderlyingType;
650public readonly TypeDesc FromType;
651public readonly TypeDesc ToType;
653public CastingPair(TypeDesc fromType, TypeDesc toType)
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\MethodDesc.cs (30)
41public TypeDesc type;
51internal TypeDesc _returnType;
52internal TypeDesc[] _parameters;
69public MethodSignature(MethodSignatureFlags flags, int genericParameterCount, TypeDesc returnType, TypeDesc[] parameters, EmbeddedSignatureData[] embeddedSignatureData = null)
86TypeDesc[] newParameters = _parameters; // Re-use existing array until conflict appears
87TypeDesc returnTypeNew = _returnType.InstantiateSignature(substitution, default(Instantiation));
91newParameters = (TypeDesc[])_parameters.Clone();
96TypeDesc newParameter = newParameters[i].InstantiateSignature(substitution, default(Instantiation));
102newParameters = (TypeDesc[])_parameters.Clone();
150public TypeDesc ReturnType
162public TypeDesc this[int index]
308static bool IsTypeEqualHelper(TypeDesc type1, TypeDesc type2, bool allowEquivalence, StackOverflowProtect visited)
352public TypeDesc Current => _signature[_index];
373private TypeDesc _returnType;
374private TypeDesc[] _parameters;
396public TypeDesc ReturnType
405public TypeDesc this[int index]
414TypeDesc[] parameters = new TypeDesc[_parameters.Length];
427_parameters = new TypeDesc[value];
514public abstract TypeDesc OwningType
732TypeDesc owningType = OwningType;
740TypeDesc[] clone = null;
744TypeDesc uninst = instantiation[i];
745TypeDesc inst = uninst.InstantiateSignature(typeInstantiation, methodInstantiation);
750clone = new TypeDesc[instantiation.Length];
762TypeDesc owningType = method.OwningType;
763TypeDesc instantiatedOwningType = owningType.InstantiateSignature(typeInstantiation, methodInstantiation);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\TypeSystemContext.cs (28)
56public ArrayType GetArrayType(TypeDesc elementType)
67private TypeDesc _elementType;
70public ArrayTypeKey(TypeDesc elementType, int rank)
76public TypeDesc ElementType
129public ArrayType GetArrayType(TypeDesc elementType, int rank)
137public class ByRefHashtable : LockFreeReaderHashtable<TypeDesc, ByRefType>
139protected override int GetKeyHashCode(TypeDesc key)
149protected override bool CompareKeyToValue(TypeDesc key, ByRefType value)
159protected override ByRefType CreateValueFromKey(TypeDesc key)
167public ByRefType GetByRefType(TypeDesc parameterType)
175public class PointerHashtable : LockFreeReaderHashtable<TypeDesc, PointerType>
177protected override int GetKeyHashCode(TypeDesc key)
187protected override bool CompareKeyToValue(TypeDesc key, PointerType value)
197protected override PointerType CreateValueFromKey(TypeDesc key)
205public PointerType GetPointerType(TypeDesc parameterType)
258private TypeDesc _typeDef;
261public InstantiatedTypeKey(TypeDesc typeDef, Instantiation instantiation)
267public TypeDesc TypeDef
642public TypeDesc GetSignatureVariable(int index, bool method)
651protected internal virtual IEnumerable<MethodDesc> GetAllMethods(TypeDesc type)
656protected internal virtual IEnumerable<MethodDesc> GetAllVirtualMethods(TypeDesc type)
665public RuntimeInterfacesAlgorithm GetRuntimeInterfacesAlgorithmForType(TypeDesc type)
674TypeDesc elementType = arrType.ElementType;
708public virtual VirtualMethodAlgorithm GetVirtualMethodAlgorithmForType(TypeDesc type)
726internal TypeFlags ComputeTypeFlags(TypeDesc type, TypeFlags flags, TypeFlags mask)
731TypeDesc typeDefinition = type.GetTypeDefinition();
754TypeDesc typeDefinition = type.GetTypeDefinition();
776protected internal abstract bool ComputeHasStaticConstructor(TypeDesc type);