[fix] 修复GenericArgumentContext不支持ElementType.FnPtr的bug

main
walon 2024-02-29 20:37:57 +08:00
parent 5446bd937c
commit 20a06f1ec5
1 changed files with 23 additions and 1 deletions

View File

@ -79,7 +79,29 @@ namespace HybridCLR.Editor.Meta
case ElementType.FnPtr: 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: case ElementType.ValueArray: