uint GetNestedTypeReferenceInternId(ITypeReference containingTypeReference, IName typeName, uint genericParameterCount) { Contract.Requires(containingTypeReference != null); Contract.Requires(typeName != null); uint containingTypeReferenceInteredId = this.GetTypeReferenceInternId(containingTypeReference); foreach (NestedTypeStore nstTypeStore in this.NestedTypeHashtable.GetValuesFor((uint)typeName.UniqueKey)) { if ( nstTypeStore.ContainingTypeInternedId == containingTypeReferenceInteredId && nstTypeStore.GenericParameterCount == genericParameterCount ) { return nstTypeStore.InternedId; } } NestedTypeStore nstTypeStore1 = new NestedTypeStore(containingTypeReferenceInteredId, genericParameterCount, this.CurrentTypeInternValue++); this.NestedTypeHashtable.Add((uint)typeName.UniqueKey, nstTypeStore1); return nstTypeStore1.InternedId; }
uint GetNestedTypeReferenceInternId(ITypeReference containingTypeReference, IName typeName, uint genericParameterCount) { Contract.Requires(containingTypeReference != null); Contract.Requires(typeName != null); uint containingTypeReferenceInternedId = this.GetTypeReferenceInternId(containingTypeReference); // If there are a large number of specializations of a type nested within a generic type, // enumerating through all specializations to find a particular one can take a long time. Therefore, // first discriminate based on the containing type. MultiHashtable<NestedTypeStore> nestedTypes = this.NestedTypeHashtable.Find(containingTypeReferenceInternedId); if (nestedTypes == null) { nestedTypes = new MultiHashtable<NestedTypeStore>(2); this.NestedTypeHashtable.Add(containingTypeReferenceInternedId, nestedTypes); } else { foreach (NestedTypeStore nstTypeStore in nestedTypes.GetValuesFor((uint)typeName.UniqueKey)) { if (nstTypeStore.GenericParameterCount == genericParameterCount) { return nstTypeStore.InternedId; } } } NestedTypeStore nstTypeStore1 = new NestedTypeStore(genericParameterCount, this.CurrentTypeInternValue++); nestedTypes.Add((uint)typeName.UniqueKey, nstTypeStore1); return nstTypeStore1.InternedId; }