[fix] 修复桥接函数签名计算的bug

main
walon 2023-08-31 11:06:06 +08:00
parent 5857696b56
commit 9dafabd1ee
1 changed files with 7 additions and 5 deletions

View File

@ -361,6 +361,8 @@ namespace HybridCLR.Editor.MethodBridge
} }
} }
public const string SigOfObj = "u";
public static string ToFullName(TypeSig type) public static string ToFullName(TypeSig type)
{ {
type = type.RemovePinnedAndModifiers(); type = type.RemovePinnedAndModifiers();
@ -372,15 +374,15 @@ namespace HybridCLR.Editor.MethodBridge
case ElementType.U1: return "u1"; case ElementType.U1: return "u1";
case ElementType.I2: return "i2"; case ElementType.I2: return "i2";
case ElementType.Char: case ElementType.Char:
case ElementType.U2: return "i2"; case ElementType.U2: return "u2";
case ElementType.I4: return "i4"; case ElementType.I4: return "i4";
case ElementType.U4: return "u4"; case ElementType.U4: return "u4";
case ElementType.I8: return "i8"; case ElementType.I8: return "i8";
case ElementType.U8: return "u8"; case ElementType.U8: return "u8";
case ElementType.R4: return "r4"; case ElementType.R4: return "r4";
case ElementType.R8: return "r8"; case ElementType.R8: return "r8";
case ElementType.U: return "u"; case ElementType.I: return "i";
case ElementType.I: case ElementType.U:
case ElementType.String: case ElementType.String:
case ElementType.Ptr: case ElementType.Ptr:
case ElementType.ByRef: case ElementType.ByRef:
@ -389,7 +391,7 @@ namespace HybridCLR.Editor.MethodBridge
case ElementType.SZArray: case ElementType.SZArray:
case ElementType.FnPtr: case ElementType.FnPtr:
case ElementType.Object: case ElementType.Object:
return "i"; return SigOfObj;
case ElementType.Module: case ElementType.Module:
case ElementType.Var: case ElementType.Var:
case ElementType.MVar: case ElementType.MVar:
@ -413,7 +415,7 @@ namespace HybridCLR.Editor.MethodBridge
GenericInstSig gis = (GenericInstSig)type; GenericInstSig gis = (GenericInstSig)type;
if (!gis.GenericType.IsValueType) if (!gis.GenericType.IsValueType)
{ {
return "i"; return SigOfObj;
} }
TypeDef typeDef = gis.GenericType.ToTypeDefOrRef().ResolveTypeDef(); TypeDef typeDef = gis.GenericType.ToTypeDefOrRef().ResolveTypeDef();
if (typeDef.IsEnum) if (typeDef.IsEnum)