Reapply "8.2版本上传"

This reverts commit e9af7221de.
This commit is contained in:
2025-06-18 17:39:12 +08:00
parent b19509ddb1
commit d48c1f1f7b
261 changed files with 9061 additions and 1336 deletions

View File

@@ -122,7 +122,7 @@ namespace HybridCLR.Editor.Meta
}
return new GenericInstSig(gia.GenericType, gia.GenericArguments.Select(ga => ToShareTypeSig(corTypes, ga)).ToList());
}
case ElementType.FnPtr: return corTypes.IntPtr;
case ElementType.FnPtr: return corTypes.UIntPtr;
case ElementType.ValueArray: return typeSig;
case ElementType.Module: return typeSig;
default:
@@ -189,5 +189,29 @@ namespace HybridCLR.Editor.Meta
}
return methodGenericParams;
}
public static bool IsSupportedPInvokeTypeSig(TypeSig typeSig)
{
typeSig = typeSig.RemovePinnedAndModifiers();
if (typeSig.IsByRef)
{
return true;
}
switch (typeSig.ElementType)
{
case ElementType.SZArray:
case ElementType.Array:
//case ElementType.Class:
case ElementType.String:
//case ElementType.Object:
return false;
default: return true;
}
}
public static bool IsSupportedPInvokeMethodSignature(MethodSig methodSig)
{
return IsSupportedPInvokeTypeSig(methodSig.RetType) && methodSig.Params.All(p => IsSupportedPInvokeTypeSig(p));
}
}
}