protected virtual unsafe TypeBuilder DefineType(BCSYM_NamedRoot *pSymbol)
        {
            TypeBuilder    builder;
            string         name           = new string(*((char **)(pSymbol + 12)));
            TypeAttributes typeAttributes = GetTypeAttributes(pSymbol);

            if (BCSYM.IsClass((BCSYM modopt(IsConst) * modopt(IsConst) modopt(IsConst))pSymbol) && (BCSYM_Class.GetBaseClass(BCSYM.PClass((BCSYM modopt(IsConst) * modopt(IsConst) modopt(IsConst))pSymbol)) != null))
            {
                Type parent = this.m_symbolMap.GetType(BCSYM_Class.GetBaseClass(BCSYM.PClass((BCSYM modopt(IsConst) * modopt(IsConst) modopt(IsConst))pSymbol)));
                builder = this.m_moduleBuilder.DefineType(name, typeAttributes, parent);
            }
Esempio n. 2
0
        public unsafe Type EmitType(BCSYM_NamedRoot *pSymbol)
        {
            BCITER_CHILD bciter_child;
            TypeBuilder  builder = this.DefineType(BCSYM.PNamedRoot((BCSYM modopt(IsConst) * modopt(IsConst) modopt(IsConst))pSymbol));

            this.m_types.Add(builder.Name, builder);
            ushort *numPtr2 = BCSYM_NamedRoot.GetCompiler(pSymbol)[12][900];

            BCITER_CHILD.Init(&bciter_child, pSymbol, false, false, false);
            for (BCSYM_NamedRoot *rootPtr = BCITER_CHILD.GetNext(&bciter_child); rootPtr != null; rootPtr = BCITER_CHILD.GetNext(&bciter_child))
            {
                if (((byte)((*(((byte *)rootPtr)) * 3)[&?s_rgBilkindInfo@BCSYM@@1QBUBilkindInfo@@B] & 0x40)) != 0)
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        public unsafe void FindMethods(BCSYM_NamedRoot *pAnonymousType, TypeBuilder typeBuilder, ref ConstructorBuilder ctorBuilder, ref MethodBuilder toStringBuilder, ref MethodBuilder equalsObjBuilder, ref MethodBuilder equalsTypeBuilder, ref MethodBuilder getHashBuilder)
        {
            BCITER_CHILD bciter_child;
            Compiler *   compilerPtr = BCSYM_NamedRoot.GetCompiler(pAnonymousType);
            ushort *     numPtr4     = Compiler.AddString(compilerPtr, & ?? _C@_1BC@GFPIDKBJ@?$AAT?$AAo?$AAS?$AAt?$AAr?$AAi?$AAn?$AAg?$AA?$AA@);
            ushort *     numPtr3     = Compiler.AddString(compilerPtr, & ?? _C@_1O@FOCMPMJF@?$AAE?$AAq?$AAu?$AAa?$AAl?$AAs?$AA?$AA@);
            ushort *     numPtr2     = Compiler.AddString(compilerPtr, & ?? _C@_1BI@KCPDAEGD@?$AAG?$AAe?$AAt?$AAH?$AAa?$AAs?$AAh?$AAC?$AAo?$AAd?$AAe?$AA?$AA@);
            ushort *     numPtr      = *((ushort **)(*(((int *)(compilerPtr + 12))) + 900));

            BCITER_CHILD.Init(&bciter_child, pAnonymousType, false, false, false);
            for (BCSYM_NamedRoot *rootPtr = BCITER_CHILD.GetNext(&bciter_child); rootPtr != null; rootPtr = BCITER_CHILD.GetNext(&bciter_child))
            {
                if (BCSYM.IsProc((BCSYM * modopt(IsConst) modopt(IsConst))rootPtr))
                {
                    int num = *((int *)(rootPtr + 12));
                    if (StringPool.IsEqual((ushort modopt(IsConst) *)num, (ushort modopt(IsConst) *)numPtr4))
                    {
                        toStringBuilder = this.DefineMethod(typeBuilder, (BCSYM_Proc *)rootPtr);
                    }