From fa4eb5db21a916bc6eba0a7df15d359315c965d2 Mon Sep 17 00:00:00 2001 From: walon Date: Tue, 29 Apr 2025 10:19:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8CMetaUtil::ToShareTyp?= =?UTF-8?q?eSig=E5=AF=B9=E4=BA=8Eclass=E7=B1=BB=E5=9E=8B=E6=B3=9B=E5=9E=8B?= =?UTF-8?q?=E4=BB=8D=E7=84=B6=E5=85=B1=E4=BA=AB=EF=BC=8C=E5=8F=AA=E5=AF=B9?= =?UTF-8?q?=E5=80=BC=E7=B1=BB=E5=9E=8B=E4=B8=8D=E5=85=B1=E4=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/Utils/MetaUtil.cs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Editor/Utils/MetaUtil.cs b/Editor/Utils/MetaUtil.cs index 5d8e95e..3001d0c 100644 --- a/Editor/Utils/MetaUtil.cs +++ b/Editor/Utils/MetaUtil.cs @@ -650,22 +650,22 @@ namespace Obfuz.Utils case ElementType.Class: return corTypes.Object; case ElementType.GenericInst: { + var gia = (GenericInstSig)a; + TypeDef typeDef = gia.GenericType.ToTypeDefOrRef().ResolveTypeDef(); + if (typeDef == null) + { + throw new Exception($"type:{a} definition could not be found"); + } + if (typeDef.IsEnum) + { + return ToShareTypeSig(corTypes, typeDef.GetEnumUnderlyingType()); + } + if (!typeDef.IsValueType) + { + return corTypes.Object; + } // il2cpp will raise error when try to share generic value type return typeSig; - //var gia = (GenericInstSig)a; - //TypeDef typeDef = gia.GenericType.ToTypeDefOrRef().ResolveTypeDef(); - //if (typeDef == null) - //{ - // throw new Exception($"type:{a} definition could not be found"); - //} - //if (typeDef.IsEnum) - //{ - // return ToShareTypeSig(corTypes, typeDef.GetEnumUnderlyingType()); - //} - //if (!typeDef.IsValueType) - //{ - // return corTypes.Object; - //} //return new GenericInstSig(gia.GenericType, gia.GenericArguments.Select(ga => ToShareTypeSig(corTypes, ga)).ToList()); } case ElementType.FnPtr: return corTypes.UIntPtr;