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}");