Ejemplo n.º 1
0
 public PopTreeList Build(ICollection instructions)
 {
     foreach (Instruction i in instructions)
     {
         PopTree p    = new PopTree(i);
         int     pops = InstructionInfo.Pops(i, _machineStack.Count);
         if (pops > _machineStack.Count)
         {
             // can happen with exception blocks whose support is flaky.
             //Console.WriteLine("Attempting to pop more than machine has: " + i.OpCode.ToString() + " " + i.Operand);
             return(null);
         }
         for (int x = 0; x < pops; x++)
         {
             p.Consume(Pop());
         }
         if (InstructionInfo.Pushes(i))
         {
             Push(p);
         }
         else
         {
             _popTreeList.Add(p);
         }
     }
     return(_popTreeList);
 }