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

◆ EmitCall()

virtual void System.Reflection.Emit.ILGenerator.EmitCall ( OpCode opcode,
MethodInfo methodInfo,
Type?[] optionalParameterTypes )
inlinevirtual

Definition at line 504 of file ILGenerator.cs.

505 {
506 if (methodInfo == null)
507 {
508 throw new ArgumentNullException("methodInfo");
509 }
510 if (!opcode.Equals(OpCodes.Call) && !opcode.Equals(OpCodes.Callvirt) && !opcode.Equals(OpCodes.Newobj))
511 {
512 throw new ArgumentException(SR.Argument_NotMethodCallOpcode, "opcode");
513 }
514 int num = 0;
515 int methodToken = GetMethodToken(methodInfo, optionalParameterTypes, useMethodDef: false);
517 InternalEmit(opcode);
518 if (methodInfo.ReturnType != typeof(void))
519 {
520 num++;
521 }
522 Type[] parameterTypes = methodInfo.GetParameterTypes();
523 if (parameterTypes != null)
524 {
525 num -= parameterTypes.Length;
526 }
527 if (!(methodInfo is SymbolMethod) && !methodInfo.IsStatic && !opcode.Equals(OpCodes.Newobj))
528 {
529 num--;
530 }
531 if (optionalParameterTypes != null)
532 {
533 num -= optionalParameterTypes.Length;
534 }
535 UpdateStackSize(opcode, num);
537 PutInteger4(methodToken);
538 }
void UpdateStackSize(OpCode opcode, int stackchange)
void InternalEmit(OpCode opcode)
int GetMethodToken(MethodBase method, Type[] optionalParameterTypes, bool useMethodDef)

References System.SR.Argument_NotMethodCallOpcode, System.Reflection.Emit.OpCodes.Call, System.Reflection.Emit.OpCodes.Callvirt, System.Reflection.Emit.ILGenerator.EnsureCapacity(), System.Reflection.Emit.OpCode.Equals(), System.Reflection.Emit.ILGenerator.GetMethodToken(), System.Reflection.MethodBase.GetParameterTypes(), System.Reflection.Emit.ILGenerator.InternalEmit(), System.Reflection.MethodBase.IsStatic, System.Reflection.Emit.OpCodes.Newobj, System.Reflection.Emit.ILGenerator.PutInteger4(), System.Reflection.Emit.ILGenerator.RecordTokenFixup(), System.Reflection.MethodInfo.ReturnType, and System.Reflection.Emit.ILGenerator.UpdateStackSize().

Referenced by System.Reflection.Emit.ILGenerator.Emit(), and System.Linq.Expressions.Compiler.LambdaCompiler.EmitMethodCall().