From 679c21da4395e7c3f3b732e2fd7871cf84ecce1c Mon Sep 17 00:00:00 2001 From: walon Date: Wed, 12 Jul 2023 23:09:58 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E4=BF=AE=E5=A4=8D=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E6=A1=A5=E6=8E=A5=E5=87=BD=E6=95=B0=E6=9C=AA=E8=80=83=E8=99=91?= =?UTF-8?q?=E5=88=B0=E6=B3=9B=E5=9E=8B=E7=B1=BB=E7=9A=84=E6=88=90=E5=91=98?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E4=B8=AD=E5=8F=AF=E8=83=BD=E5=8C=85=E5=90=AB?= =?UTF-8?q?Native2Manager=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/Meta/MetaUtil.cs | 2 ++ Editor/Meta/MethodReferenceAnalyzer.cs | 9 --------- Editor/MethodBridge/Analyzer.cs | 17 +++-------------- 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/Editor/Meta/MetaUtil.cs b/Editor/Meta/MetaUtil.cs index 539eb91..7f9c38a 100644 --- a/Editor/Meta/MetaUtil.cs +++ b/Editor/Meta/MetaUtil.cs @@ -93,6 +93,8 @@ namespace HybridCLR.Editor.Meta case ElementType.SZArray: return corTypes.Object; case ElementType.Array: return corTypes.Object; case ElementType.ValueType: return typeSig; + case ElementType.Var: + case ElementType.MVar: case ElementType.Class: return corTypes.Object; case ElementType.GenericInst: { diff --git a/Editor/Meta/MethodReferenceAnalyzer.cs b/Editor/Meta/MethodReferenceAnalyzer.cs index 4f9ceb0..bb36692 100644 --- a/Editor/Meta/MethodReferenceAnalyzer.cs +++ b/Editor/Meta/MethodReferenceAnalyzer.cs @@ -22,15 +22,6 @@ namespace HybridCLR.Editor.Meta public void WalkMethod(MethodDef method, List klassGenericInst, List methodGenericInst) { - if (klassGenericInst != null || methodGenericInst != null) - { - //var typeSig = klassGenericInst != null ? new GenericInstSig(method.DeclaringType.ToTypeSig().ToClassOrValueTypeSig(), klassGenericInst) : method.DeclaringType?.ToTypeSig(); - //Debug.Log($"== walk generic method {typeSig}::{method.Name} {method.MethodSig}"); - } - else - { - //Debug.Log($"== walk not geneeric method:{method}"); - } var ctx = new GenericArgumentContext(klassGenericInst, methodGenericInst); if (_methodEffectInsts.TryGetValue(method, out var effectInsts)) diff --git a/Editor/MethodBridge/Analyzer.cs b/Editor/MethodBridge/Analyzer.cs index d686389..6e94dd2 100644 --- a/Editor/MethodBridge/Analyzer.cs +++ b/Editor/MethodBridge/Analyzer.cs @@ -149,23 +149,16 @@ namespace HybridCLR.Editor.MethodBridge for (uint rid = 1, n = ass.Metadata.TablesStream.TypeSpecTable.Rows; rid <= n; rid++) { var ts = ass.ResolveTypeSpec(rid); - if (!ts.ContainsGenericParameter) + var cs = GenericClass.ResolveClass(ts, null)?.ToGenericShare(); + if (cs != null) { - var cs = GenericClass.ResolveClass(ts, null)?.ToGenericShare(); - if (cs != null) - { - TryAddAndWalkGenericType(cs); - } + TryAddAndWalkGenericType(cs); } } for (uint rid = 1, n = ass.Metadata.TablesStream.MethodSpecTable.Rows; rid <= n; rid++) { var ms = ass.ResolveMethodSpec(rid); - if(ms.DeclaringType.ContainsGenericParameter || ms.GenericInstMethodSig.ContainsGenericParameter) - { - continue; - } var gm = GenericMethod.ResolveMethod(ms, null)?.ToGenericShare(); if (gm == null) { @@ -176,10 +169,6 @@ namespace HybridCLR.Editor.MethodBridge { _newMethods.Add(gm); } - //if (gm.KlassInst != null) - //{ - // TryAddAndWalkGenericType(new GenericClass(gm.Method.DeclaringType, gm.KlassInst)); - //} } } Debug.Log($"PostPrepare allMethods:{_notGenericMethods.Count} newMethods:{_newMethods.Count}");