Exemplo n.º 1
0
 public void Reset()
 {
     // 初始化管理器
     TypeMgr = new TypeManager(this);
 }
Exemplo n.º 2
0
 public TypeGenerator(TypeManager typeMgr)
 {
     TypeMgr   = typeMgr;
     StringGen = new StringGenerator(this);
     MethodGen = new MethodGenerator(typeMgr, StringGen, this);
 }
Exemplo n.º 3
0
 public GeneratorContext(TypeManager typeMgr)
 {
     TypeMgr = typeMgr;
 }
Exemplo n.º 4
0
        private static void SigToCppName(TypeSig sig, StringBuilder sb, TypeManager typeMgr)
        {
            string elemName = GetElemTypeName(sig.ElementType);

            if (elemName != null)
            {
                sb.Append(elemName);
                return;
            }

            switch (sig.ElementType)
            {
            case ElementType.Class:
            case ElementType.ValueType:
            case ElementType.GenericInst:
            {
                TypeX type = typeMgr.GetTypeByName(sig.FullName);
                if (type != null)
                {
                    if (type.Def.IsValueType)
                    {
                        sb.Append(type.GetCppName());
                    }
                    else
                    {
                        sb.Append("struct " + type.GetCppName() + '*');
                    }
                }
                else
                {
                    if (sig.IsValueType)
                    {
                        sb.Append("il2cppValueType");
                    }
                    else
                    {
                        sb.Append("il2cppObject*");
                    }
                }
            }
                return;

            case ElementType.Ptr:
            case ElementType.ByRef:
                SigToCppName(sig.Next, sb, typeMgr);
                sb.Append('*');
                return;

            case ElementType.SZArray:
                sb.Append("il2cppSZArray<");
                SigToCppName(sig.Next, sb, typeMgr);
                sb.Append(">*");
                return;

            case ElementType.Array:
                //! il2cppArray<next, 0, 10, 0, 10, ...>*
                break;

            case ElementType.Pinned:
            case ElementType.CModReqd:
            case ElementType.CModOpt:
                SigToCppName(sig.Next, sb, typeMgr);
                return;

            default:
                throw new ArgumentOutOfRangeException("SigToCppName TypeSig " + sig.FullName);
            }
        }