Пример #1
0
 private static int Map(StackBehaviour[] array, System.Reflection.Emit.StackBehaviour stackBehaviour)
 {
     for (int i = 0; i < array.Length; i++)
     {
         if ((int)array[i] == (int)stackBehaviour)
         {
             return(i);
         }
     }
     throw new InvalidOperationException();
 }
Пример #2
0
        static int GetStackDiff(System.Reflection.Emit.StackBehaviour sb)
        {
            switch (sb)
            {
            case System.Reflection.Emit.StackBehaviour.Pop0:
            case System.Reflection.Emit.StackBehaviour.Push0:
            case System.Reflection.Emit.StackBehaviour.Varpop:
            case System.Reflection.Emit.StackBehaviour.Varpush:
                return(0);

            case System.Reflection.Emit.StackBehaviour.Pop1:
            case System.Reflection.Emit.StackBehaviour.Popi:
            case System.Reflection.Emit.StackBehaviour.Popref:
                return(-1);

            case System.Reflection.Emit.StackBehaviour.Pop1_pop1:
            case System.Reflection.Emit.StackBehaviour.Popi_pop1:
            case System.Reflection.Emit.StackBehaviour.Popi_popi:
            case System.Reflection.Emit.StackBehaviour.Popi_popi8:
            case System.Reflection.Emit.StackBehaviour.Popi_popr4:
            case System.Reflection.Emit.StackBehaviour.Popi_popr8:
            case System.Reflection.Emit.StackBehaviour.Popref_pop1:
            case System.Reflection.Emit.StackBehaviour.Popref_popi:
                return(-2);

            case System.Reflection.Emit.StackBehaviour.Popi_popi_popi:
            case System.Reflection.Emit.StackBehaviour.Popref_popi_pop1:
            case System.Reflection.Emit.StackBehaviour.Popref_popi_popi:
            case System.Reflection.Emit.StackBehaviour.Popref_popi_popi8:
            case System.Reflection.Emit.StackBehaviour.Popref_popi_popr4:
            case System.Reflection.Emit.StackBehaviour.Popref_popi_popr8:
            case System.Reflection.Emit.StackBehaviour.Popref_popi_popref:
                return(-3);

            case System.Reflection.Emit.StackBehaviour.Push1:
            case System.Reflection.Emit.StackBehaviour.Pushi:
            case System.Reflection.Emit.StackBehaviour.Pushi8:
            case System.Reflection.Emit.StackBehaviour.Pushr4:
            case System.Reflection.Emit.StackBehaviour.Pushr8:
            case System.Reflection.Emit.StackBehaviour.Pushref:
                return(1);

            case System.Reflection.Emit.StackBehaviour.Push1_push1:
                return(2);
            }
            throw new InvalidOperationException();
        }