31 return GetMethodSigHelper(mod, callingConvention, returnType,
null,
null,
null,
null,
null);
37 signatureHelper.
AddData(inst.Length);
38 foreach (
Type clsArgument
in inst)
40 signatureHelper.AddArgument(clsArgument);
42 return signatureHelper;
47 return GetMethodSigHelper(scope, callingConvention, 0, returnType, requiredReturnTypeCustomModifiers, optionalReturnTypeCustomModifiers, parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers);
52 if (returnType ==
null)
54 returnType = typeof(
void);
61 if (cGenericParam > 0)
69 SignatureHelper signatureHelper =
new SignatureHelper(scope, mdSigCallingConvention, cGenericParam, returnType, requiredReturnTypeCustomModifiers, optionalReturnTypeCustomModifiers);
70 signatureHelper.
AddArguments(parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers);
71 return signatureHelper;
76 if ((
object)returnType ==
null)
78 returnType = typeof(
void);
81 switch (unmanagedCallConv)
99 return new SignatureHelper(mod, callingConvention, returnType,
null,
null);
134 return GetPropertySigHelper(mod, (
CallingConventions)0, returnType, requiredReturnTypeCustomModifiers, optionalReturnTypeCustomModifiers, parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers);
139 if (returnType ==
null)
141 returnType = typeof(
void);
148 SignatureHelper signatureHelper =
new SignatureHelper(mod, mdSigCallingConvention, returnType, requiredReturnTypeCustomModifiers, optionalReturnTypeCustomModifiers);
149 signatureHelper.
AddArguments(parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers);
150 return signatureHelper;
168 Init(mod, callingConvention);
173 Init(mod, callingConvention, cGenericParameters);
182 : this(mod, callingConvention, 0, returnType, requiredCustomModifiers, optionalCustomModifiers)
192 [MemberNotNull(
"m_signature")]
201 if (
m_module ==
null && mod !=
null)
207 [MemberNotNull(
"m_signature")]
210 Init(mod, callingConvention, 0);
213 [MemberNotNull(
"m_signature")]
217 AddData((
int)callingConvention);
223 if (cGenericParam > 0)
241 if (optionalCustomModifiers !=
null)
243 foreach (
Type type in optionalCustomModifiers)
249 if (
type.HasElementType)
253 if (
type.ContainsGenericParameters)
262 if (requiredCustomModifiers !=
null)
264 foreach (
Type type2
in requiredCustomModifiers)
311 AddData(genericArguments.Length);
374 for (
int j = 0; j < arrayRank; j++)
386 if (clsArgument == typeof(
object))
390 else if (clsArgument == typeof(
string))
431 if (data <= 536870911)
451 int num = token & 0xFFFFFF;
458 switch (metadataTokenType)
484 byte* ptr = (
byte*)(&
value);
485 for (
int i = 0; i <
sizeof(
void*); i++)
496 private static byte[]
ExpandArray(
byte[] inArray,
int requiredLength)
498 if (requiredLength < inArray.Length)
500 requiredLength = inArray.Length * 2;
502 byte[]
array =
new byte[requiredLength];
565 num = ((argCount < 127) ? (num + 1) : ((argCount >= 16383) ? (num + 4) : (num + 2)));
566 byte[]
array =
new byte[num];
571 array[dstOffset++] = (byte)((uint)argCount & 0xFFu);
573 else if (argCount <= 16383)
575 array[dstOffset++] = (byte)((uint)(argCount >> 8) | 0x80u);
576 array[dstOffset++] = (byte)((uint)argCount & 0xFFu);
580 if (argCount > 536870911)
584 array[dstOffset++] = (byte)((uint)(argCount >> 24) | 0xC0u);
585 array[dstOffset++] = (byte)((uint)(argCount >> 16) & 0xFFu);
586 array[dstOffset++] = (byte)((uint)(argCount >> 8) & 0xFFu);
587 array[dstOffset++] = (byte)((uint)argCount & 0xFFu);
601 if (argument ==
null)
611 if (requiredCustomModifiers !=
null && (arguments ==
null || requiredCustomModifiers.Length != arguments.Length))
615 if (optionalCustomModifiers !=
null && (arguments ==
null || optionalCustomModifiers.Length != arguments.Length))
619 if (arguments !=
null)
621 for (
int i = 0; i < arguments.Length; i++)
623 AddArgument(arguments[i], (requiredCustomModifiers !=
null) ? requiredCustomModifiers[i] :
null, (optionalCustomModifiers !=
null) ? optionalCustomModifiers[i] :
null);
634 if (argument ==
null)
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
static void BlockCopy(Array src, int srcOffset, Array dst, int dstOffset, int count)
static void WriteInt16BigEndian(Span< byte > destination, short value)
static void WriteInt32BigEndian(Span< byte > destination, int value)
override int GetHashCode()
int GetTypeToken(Type type)
override bool Equals(object? obj)
override bool Equals(object? obj)
unsafe void InternalAddRuntimeType(Type type)
static byte[] ExpandArray(byte[] inArray)
static SignatureHelper GetLocalVarSigHelper(Module? mod)
void Init(Module mod, MdSigCallingConvention callingConvention, int cGenericParam)
void AddOneArgTypeHelper(Type clsArgument)
static SignatureHelper GetTypeSigToken(Module module, Type type)
static byte[] ExpandArray(byte[] inArray, int requiredLength)
byte[] InternalGetSignature(out int length)
void IncrementArgCounts()
override string ToString()
static bool IsSimpleType(CorElementType type)
void InternalAddTypeToken(int clsToken, CorElementType CorType)
static SignatureHelper GetMethodSigHelper(CallingConventions callingConvention, Type? returnType)
static SignatureHelper GetFieldSigHelper(Module? mod)
static SignatureHelper GetPropertySigHelper(Module? mod, Type? returnType, Type[]? requiredReturnTypeCustomModifiers, Type[]? optionalReturnTypeCustomModifiers, Type[]? parameterTypes, Type[][]? requiredParameterTypeCustomModifiers, Type[][]? optionalParameterTypeCustomModifiers)
static SignatureHelper GetLocalVarSigHelper()
void AddArgument(Type argument, bool pinned)
void SetNumberOfSignatureElements(bool forceCopy)
void AddArgument(Type clsArgument)
void AddOneArgTypeHelperWorker(Type clsArgument, bool lastWasGenericInst)
static SignatureHelper GetMethodSigHelper(Module? mod, CallingConventions callingConvention, Type? returnType)
static SignatureHelper GetMethodSigHelper(CallingConvention unmanagedCallingConvention, Type returnType)
SignatureHelper(Module mod, Type type)
void AddOneArgTypeHelper(Type argument, bool pinned)
void AddOneArgTypeHelper(Type clsArgument, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
void AddArguments(Type[]? arguments, Type[][]? requiredCustomModifiers, Type[][]? optionalCustomModifiers)
static SignatureHelper GetMethodSigHelper(Module? mod, Type? returnType, Type[]? parameterTypes)
static SignatureHelper GetMethodSigHelper(Module scope, CallingConventions callingConvention, Type returnType, Type[] requiredReturnTypeCustomModifiers, Type[] optionalReturnTypeCustomModifiers, Type[] parameterTypes, Type[][] requiredParameterTypeCustomModifiers, Type[][] optionalParameterTypeCustomModifiers)
override int GetHashCode()
static SignatureHelper GetMethodSigHelper(Module scope, CallingConventions callingConvention, int cGenericParam, Type returnType, Type[] requiredReturnTypeCustomModifiers, Type[] optionalReturnTypeCustomModifiers, Type[] parameterTypes, Type[][] requiredParameterTypeCustomModifiers, Type[][] optionalParameterTypeCustomModifiers)
byte[] InternalGetSignatureArray()
static SignatureHelper GetMethodSpecSigHelper(Module scope, Type[] inst)
void AddElementType(CorElementType cvt)
static SignatureHelper GetMethodSigHelper(Module mod, CallingConvention unmanagedCallConv, Type returnType)
byte[] GetSignature(bool appendEndOfSig)
SignatureHelper(Module mod, MdSigCallingConvention callingConvention, Type returnType, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
void AddArgument(Type argument, Type[]? requiredCustomModifiers, Type[]? optionalCustomModifiers)
SignatureHelper(Module mod, MdSigCallingConvention callingConvention)
SignatureHelper(Module mod, MdSigCallingConvention callingConvention, int cGenericParameters, Type returnType, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
void Init(Module mod, MdSigCallingConvention callingConvention)
static SignatureHelper GetPropertySigHelper(Module? mod, CallingConventions callingConvention, Type? returnType, Type[]? requiredReturnTypeCustomModifiers, Type[]? optionalReturnTypeCustomModifiers, Type[]? parameterTypes, Type[][]? requiredParameterTypeCustomModifiers, Type[][]? optionalParameterTypeCustomModifiers)
static SignatureHelper GetPropertySigHelper(Module? mod, Type? returnType, Type[]? parameterTypes)
override bool Equals(object? o)
static string Argument_ArraysInvalid
static string Format(string resourceFormat, object p1)
static string Argument_LargeInteger
static string Argument_SigIsFinalized
static string Argument_BadFieldSig
static string NotSupported_MustBeModuleBuilder
static string Argument_MismatchedArrays
static string Argument_GenericsInvalid
static string Argument_UnknownUnmanagedCallConv
StringBuilder AppendLine()
override string ToString()
StringBuilder Append(char value, int repeatCount)
virtual ? MethodBase DeclaringMethod
virtual Type[] GetGenericArguments()
virtual bool IsGenericParameter
virtual int GenericParameterPosition
virtual int GetArrayRank()
virtual bool IsGenericType
virtual bool IsGenericTypeDefinition
virtual bool ContainsGenericParameters
virtual Type GetGenericTypeDefinition()
static CorElementType GetCorElementType(RuntimeType type)