From 20a06f1ec5d004f5fdedfc30d1fd0a8a9dacc6e6 Mon Sep 17 00:00:00 2001 From: walon Date: Thu, 29 Feb 2024 20:37:57 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E4=BF=AE=E5=A4=8DGenericArgumentContex?= =?UTF-8?q?t=E4=B8=8D=E6=94=AF=E6=8C=81ElementType.FnPtr=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/Meta/GenericArgumentContext.cs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Editor/Meta/GenericArgumentContext.cs b/Editor/Meta/GenericArgumentContext.cs index 47883f5..ddff3d7 100644 --- a/Editor/Meta/GenericArgumentContext.cs +++ b/Editor/Meta/GenericArgumentContext.cs @@ -79,7 +79,29 @@ namespace HybridCLR.Editor.Meta case ElementType.FnPtr: { - throw new NotSupportedException(typeSig.ToString()); + var fptr = (FnPtrSig)typeSig; + var cs = fptr.Signature; + CallingConventionSig ccs; + switch (cs) + { + case MethodSig ms: + { + ccs = new MethodSig(ms.GetCallingConvention(), ms.GenParamCount, Resolve(ms.RetType), ms.Params.Select(p => Resolve(p)).ToList()); + break; + } + case PropertySig ps: + { + ccs = new PropertySig(ps.HasThis, Resolve(ps.RetType)); + break; + } + case GenericInstMethodSig gims: + { + ccs = new GenericInstMethodSig(gims.GenericArguments.Select(ga => Resolve(ga)).ToArray()); + break; + } + default: throw new NotSupportedException(cs.ToString()); + } + return new FnPtrSig(ccs); } case ElementType.ValueArray: