uint GetTypeReferenceInterendIdIgnoringCustomModifiers(ITypeReference typeReference) {
Contract.Requires(typeReference != null);
INamespaceTypeReference/*?*/ namespaceTypeReference = typeReference as INamespaceTypeReference;
if (namespaceTypeReference != null) {
return this.GetNamespaceTypeReferenceInternId(
namespaceTypeReference.ContainingUnitNamespace,
namespaceTypeReference.Name,
namespaceTypeReference.GenericParameterCount
);
}
INestedTypeReference/*?*/ nestedTypeReference = typeReference as INestedTypeReference;
if (nestedTypeReference != null) {
return this.GetNestedTypeReferenceInternId(
nestedTypeReference.ContainingType,
nestedTypeReference.Name,
nestedTypeReference.GenericParameterCount
);
}
IArrayTypeReference/*?*/ arrayTypeReference = typeReference as IArrayTypeReference;
if (arrayTypeReference != null) {
if (arrayTypeReference.IsVector) {
return this.GetVectorTypeReferenceInternId(arrayTypeReference.ElementType);
} else {
return this.GetMatrixTypeReferenceInternId(
arrayTypeReference.ElementType,
(int)arrayTypeReference.Rank,
arrayTypeReference.Sizes,
arrayTypeReference.LowerBounds
);
}
}
IGenericTypeInstanceReference/*?*/ genericTypeInstanceReference = typeReference as IGenericTypeInstanceReference;
if (genericTypeInstanceReference != null) {
return this.GetGenericTypeInstanceReferenceInternId(
genericTypeInstanceReference.GenericType,
genericTypeInstanceReference.GenericArguments
);
}
IPointerTypeReference/*?*/ pointerTypeReference = typeReference as IPointerTypeReference;
if (pointerTypeReference != null) {
return this.GetPointerTypeReferenceInternId(pointerTypeReference.TargetType);
}
IManagedPointerTypeReference managedPointerTypeReference = typeReference as IManagedPointerTypeReference;
if (managedPointerTypeReference != null) {
return this.GetManagedPointerTypeReferenceInternId(managedPointerTypeReference.TargetType);
}
IGenericTypeParameterReference/*?*/ genericTypeParameterReference = typeReference as IGenericTypeParameterReference;
if (genericTypeParameterReference != null) {
return this.GetGenericTypeParameterReferenceInternId(
genericTypeParameterReference.DefiningType,
(int)genericTypeParameterReference.Index
);
}
IGenericMethodParameterReference/*?*/ genericMethodParameterReference = typeReference as IGenericMethodParameterReference;
if (genericMethodParameterReference != null) {
return this.GetGenericMethodParameterReferenceInternId(genericMethodParameterReference.DefiningMethod, genericMethodParameterReference.Index);
}
IFunctionPointerTypeReference/*?*/ functionPointerTypeReference = typeReference as IFunctionPointerTypeReference;
if (functionPointerTypeReference != null) {
IEnumerable<ICustomModifier> returnValueCustomModifiers;
if (functionPointerTypeReference.ReturnValueIsModified)
returnValueCustomModifiers = functionPointerTypeReference.ReturnValueCustomModifiers;
else
returnValueCustomModifiers = Enumerable<ICustomModifier>.Empty;
return this.GetFunctionPointerTypeReferenceInternId(
functionPointerTypeReference.CallingConvention,
functionPointerTypeReference.Parameters,
functionPointerTypeReference.ExtraArgumentTypes,
returnValueCustomModifiers,
functionPointerTypeReference.ReturnValueIsByRef,
functionPointerTypeReference.Type
);
}
//^ assume false; //It is an informal requirement that all classes implementing ITypeReference should produce a non null result for one of the calls above.
return 0;
}