src\runtime\src\coreclr\tools\Common\TypeSystem\Common\CastingHelper.cs (53)
15public static bool CanCastTo(this TypeDesc thisType, TypeDesc otherType)
24private static TypeFlags GetReducedTypeElementType(TypeDesc type)
48private static TypeFlags GetVerificationTypeElementType(TypeDesc type)
66private static bool AreVerificationTypesEqual(TypeDesc type1, TypeDesc type2)
89private static bool IsMethodSignatureCompatibleWith(TypeDesc fn1Ttype, TypeDesc fn2Type)
99public static bool IsCompatibleWith(this TypeDesc thisType, TypeDesc otherType)
104internal static bool IsCompatibleWith(this TypeDesc thisType, TypeDesc otherType, StackOverflowProtect visited)
150public static bool IsEquivalentTo(this TypeDesc thisType, TypeDesc otherType)
159internal static bool IsEquivalentTo(this TypeDesc thisType, TypeDesc otherType, StackOverflowProtect visited)
168static partial void IsEquivalentTo(this TypeDesc thisType, TypeDesc otherType, StackOverflowProtect visited, ref bool isEquivalentTo);
169private static bool CanCastToInternal(this TypeDesc thisType, TypeDesc otherType, StackOverflowProtect protect)
202private static bool CanCastGenericParameterTo(this GenericParameterDesc thisType, TypeDesc otherType, StackOverflowProtect protect)
225typeInstantiation = ((TypeDesc)thisType.AssociatedTypeOrMethod).Instantiation;
227foreach (var typeConstraint in thisType.TypeConstraints)
229TypeDesc instantiatedConstraint = typeConstraint.InstantiateSignature(typeInstantiation, methodInstantiation);
239private static bool CanCastArrayTo(this ArrayType thisType, TypeDesc otherType, StackOverflowProtect protect)
272private static bool CanCastParamTo(this ParameterizedType thisType, TypeDesc paramType, StackOverflowProtect protect)
283TypeDesc curTypesParm = thisType.ParameterType;
286TypeDesc fromParamUnderlyingType = curTypesParm.UnderlyingType;
301TypeDesc toParamUnderlyingType = paramType.UnderlyingType;
314foreach (var typeConstraint in type.TypeConstraints)
336private static TypeFlags GetNormalizedIntegralArrayElementType(TypeDesc type)
360public static bool IsArrayElementTypeCastableBySize(TypeDesc elementType)
380private static bool CanCastToClassOrInterface(this TypeDesc thisType, TypeDesc otherType, StackOverflowProtect protect)
392private static bool CanCastToInterface(this TypeDesc thisType, TypeDesc otherType, StackOverflowProtect protect)
419private static bool CanCastToNonVariantInterface(this TypeDesc thisType, TypeDesc otherType)
437private static bool CanCastByVarianceToInterfaceOrDelegate(this TypeDesc thisType, TypeDesc otherType, StackOverflowProtect protectInput, bool arrayCovariance = false)
467TypeDesc arg = instantiationThis[i];
468TypeDesc targetArg = instantiationTarget[i];
498private static bool CanCastToClass(this TypeDesc thisType, TypeDesc otherType, StackOverflowProtect protect)
500TypeDesc curType = thisType;
554private static bool IsBoxedAndCanCastTo(this TypeDesc thisType, TypeDesc otherType, StackOverflowProtect protect, bool arrayCovariance)
556TypeDesc fromUnderlyingType = thisType.UnderlyingType;
572TypeDesc toUnderlyingType = otherType.UnderlyingType;
613public readonly TypeDesc FromType;
614public readonly TypeDesc ToType;
616public CastingPair(TypeDesc fromType, TypeDesc toType)
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\MethodDesc.cs (30)
40public TypeDesc type;
50internal TypeDesc _returnType;
51internal TypeDesc[] _parameters;
68public MethodSignature(MethodSignatureFlags flags, int genericParameterCount, TypeDesc returnType, TypeDesc[] parameters, EmbeddedSignatureData[] embeddedSignatureData = null)
85TypeDesc[] newParameters = _parameters; // Re-use existing array until conflict appears
86TypeDesc returnTypeNew = _returnType.InstantiateSignature(substitution, default(Instantiation));
90newParameters = (TypeDesc[])_parameters.Clone();
95TypeDesc newParameter = newParameters[i].InstantiateSignature(substitution, default(Instantiation));
101newParameters = (TypeDesc[])_parameters.Clone();
149public TypeDesc ReturnType
161public TypeDesc this[int index]
307static bool IsTypeEqualHelper(TypeDesc type1, TypeDesc type2, bool allowEquivalence, StackOverflowProtect visited)
351public TypeDesc Current => _signature[_index];
372private TypeDesc _returnType;
373private TypeDesc[] _parameters;
395public TypeDesc ReturnType
404public TypeDesc this[int index]
413TypeDesc[] parameters = new TypeDesc[_parameters.Length];
426_parameters = new TypeDesc[value];
513public abstract TypeDesc OwningType
729TypeDesc owningType = OwningType;
737TypeDesc[] clone = null;
741TypeDesc uninst = instantiation[i];
742TypeDesc inst = uninst.InstantiateSignature(typeInstantiation, methodInstantiation);
747clone = new TypeDesc[instantiation.Length];
759TypeDesc owningType = method.OwningType;
760TypeDesc 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);