Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetMemberRefToken()

int System.Reflection.Emit.ModuleBuilder.GetMemberRefToken ( MethodBase method,
Type[] optionalParameterTypes )
inlineprivate

Definition at line 272 of file ModuleBuilder.cs.

273 {
274 int cGenericParameters = 0;
275 if (method.IsGenericMethod)
276 {
277 if (!method.IsGenericMethodDefinition)
278 {
279 throw new InvalidOperationException();
280 }
281 cGenericParameters = method.GetGenericArguments().Length;
282 }
283 if (optionalParameterTypes != null && (method.CallingConvention & CallingConventions.VarArgs) == 0)
284 {
285 throw new InvalidOperationException(SR.InvalidOperation_NotAVarArgCallingConvention);
286 }
287 MethodInfo methodInfo = method as MethodInfo;
288 SignatureHelper memberRefSignature;
289 if (method.DeclaringType.IsGenericType)
290 {
293 }
294 else
295 {
297 }
298 if (optionalParameterTypes != null && optionalParameterTypes.Length != 0)
299 {
300 memberRefSignature.AddSentinel();
301 memberRefSignature.AddArguments(optionalParameterTypes, null, null);
302 }
303 int length;
304 byte[] signature = memberRefSignature.InternalGetSignature(out length);
305 int tr;
306 if (!method.DeclaringType.IsGenericType)
307 {
308 tr = ((!method.Module.Equals(this)) ? GetTypeToken(method.DeclaringType) : ((!(methodInfo != null)) ? GetConstructorToken(method as ConstructorInfo) : GetMethodToken(methodInfo)));
309 }
310 else
311 {
312 int length2;
313 byte[] signature2 = SignatureHelper.GetTypeSigToken(this, method.DeclaringType).InternalGetSignature(out length2);
315 }
317 }
static int GetTokenFromTypeSpec(QCallModule pModule, byte[] signature, int length)
int GetConstructorToken(ConstructorInfo con)
static MethodBase GetGenericMethodBaseDefinition(MethodBase methodBase)
SignatureHelper GetMemberRefSignature(CallingConventions call, Type returnType, Type[] parameterTypes, Type[][] requiredCustomModifiers, Type[][] optionalCustomModifiers, Type[] optionalParameterTypes, int cGenericParameters)
static int GetMemberRefFromSignature(QCallModule module, int tr, string methodName, byte[] signature, int length)
int GetMethodToken(MethodInfo method)

References System.Reflection.Emit.ModuleBuilder.GetConstructorToken(), System.Reflection.Emit.ModuleBuilder.GetGenericMethodBaseDefinition(), System.Reflection.Emit.ModuleBuilder.GetMemberRefFromSignature(), System.Reflection.Emit.ModuleBuilder.GetMemberRefSignature(), System.Reflection.Emit.ModuleBuilder.GetMethodToken(), System.Reflection.Emit.ModuleBuilder.GetTokenFromTypeSpec(), System.Reflection.Emit.SignatureHelper.GetTypeSigToken(), System.Reflection.Emit.ModuleBuilder.GetTypeToken(), System.SR.InvalidOperation_NotAVarArgCallingConvention, System.length, and System.length2.

Referenced by System.Reflection.Emit.ModuleBuilder.GetMethodTokenInternal(), and System.Reflection.Emit.ModuleBuilder.GetMethodTokenNoLock().