public unsafe Type EmitType(BCSYM_NamedRoot *pSymbol) { TypeBuilder builder = this.DefineType(BCSYM.PNamedRoot((BCSYM modopt(IsConst) * modopt(IsConst) modopt(IsConst))pSymbol)); this.m_types.Add(builder.Name, builder); bool hasKey = false; int num2 = BCSYM.GetGenericParamCount((BCSYM * modopt(IsConst) modopt(IsConst))pSymbol); PropertyAndField[] properties = new PropertyAndField[num2]; BCSYM_GenericParam *pParam = BCSYM.GetFirstGenericParam((BCSYM * modopt(IsConst) modopt(IsConst))pSymbol); int index = 0; if (0 < num2) { do { PropertyAndField prop = this.FindPropertyAndField(pSymbol, pParam, builder, &hasKey); properties[index] = prop; this.EmitProperty(prop); pParam = *((BCSYM_GenericParam **)(pParam + 80)); index++; }while (index < num2); } ConstructorBuilder ctorBuilder = null; MethodBuilder toStringBuilder = null; MethodBuilder equalsObjBuilder = null; MethodBuilder equalsTypeBuilder = null; MethodBuilder getHashBuilder = null; this.FindMethods(pSymbol, builder, ref ctorBuilder, ref toStringBuilder, ref equalsObjBuilder, ref equalsTypeBuilder, ref getHashBuilder); this.EmitCtor(properties, ctorBuilder); this.EmitToString(properties, toStringBuilder); if (hasKey) { Type interfaceType = typeof(IEquatable <>).MakeGenericType(new Type[] { builder }); builder.AddInterfaceImplementation(interfaceType); this.EmitEqualsTyped(properties, equalsTypeBuilder); this.EmitEqualsObj(builder, equalsObjBuilder, equalsTypeBuilder); this.EmitGetHashCode(properties, getHashBuilder); } Type type = builder.CreateType(); this.m_types[builder.Name] = type; return(type); }
protected virtual unsafe void DefineGenericTypeParameter(TypeBuilder typeBuilder, GenericTypeParameterBuilder paramBuilder, BCSYM_GenericParam *pParam) { paramBuilder.SetGenericParameterAttributes(GetGenericParameterAttributes(pParam)); List <Type> list = new List <Type>(); for (BCSYM_GenericConstraint *constraintPtr = *((BCSYM_GenericConstraint **)(pParam + 0x54)); constraintPtr != null; constraintPtr = *((BCSYM_GenericConstraint **)(constraintPtr + 8))) { if (((byte)(*(((byte *)constraintPtr)) == 0x26)) != 0) { BCSYM *pSymbol = BCSYM.DigThroughNamedType(*((BCSYM * modopt(IsConst) modopt(IsConst) *)(constraintPtr + 12))); Type item = this.GetType(typeBuilder, pSymbol); if (BCSYM.IsInterface(pSymbol)) { list.Add(item); } else { paramBuilder.SetBaseTypeConstraint(item); } } } if (list.Count > 0) { paramBuilder.SetInterfaceConstraints(list.ToArray()); } }