ComputePopDelta() static private method

static private ComputePopDelta ( StackBehaviour pop_behavior, int &stack_size ) : void
pop_behavior StackBehaviour
stack_size int
return void
コード例 #1
0
 private static void ComputeStackDelta(Instruction instruction, ref int stack_size)
 {
     if (instruction.opcode.FlowControl != FlowControl.Call)
     {
         CodeWriter.ComputePopDelta(instruction.opcode.StackBehaviourPop, ref stack_size);
         CodeWriter.ComputePushDelta(instruction.opcode.StackBehaviourPush, ref stack_size);
     }
     else
     {
         IMethodSignature methodSignature = (IMethodSignature)instruction.operand;
         if (methodSignature.HasImplicitThis() && instruction.opcode.Code != Code.Newobj)
         {
             stack_size--;
         }
         if (methodSignature.HasParameters)
         {
             stack_size -= methodSignature.Parameters.Count;
         }
         if (instruction.opcode.Code == Code.Calli)
         {
             stack_size--;
         }
         if (methodSignature.ReturnType.etype != ElementType.Void || instruction.opcode.Code == Code.Newobj)
         {
             stack_size++;
             return;
         }
     }
 }