private static HLType CreateType(ITypeDefinition pDefinition) { HLType type = new HLType(); type.Definition = pDefinition; type.Name = pDefinition.ToString(); // TODO: Don't really like this, should use TypeHelper perhaps? type.Signature = HLDomain.GetTypeSignature(pDefinition); sTypes[type.Signature] = type; ITypeReference referenceBase = pDefinition.BaseClasses.FirstOrDefault(); if (referenceBase != null) { type.BaseType = GetOrCreateType(referenceBase); type.BaseType.MemberFields.ForEach(f => type.Fields.Add(f)); } foreach (IFieldDefinition fieldDefinition in pDefinition.Fields.OrderBy(d => d.SequenceNumber)) { CreateField(type, fieldDefinition); } IMethodDefinition definitionStaticConstructor = pDefinition.Methods.FirstOrDefault(d => d.IsStaticConstructor); if (definitionStaticConstructor != null) { type.StaticConstructor = GetOrCreateMethod(definitionStaticConstructor); } return(type); }