Пример #1
0
        /// <summary>Pops a labelled block from the stack.</summary>
        public LabelledBlock PopBlock()
        {
            // Pop it:
            LabelledBlock block            = BlockStack.Pop();
            Instruction   blockInstruction = block.Instruction;

            // Transfer all instructions on the FunctionBody.Root stack
            // into blockInstruction up to but not
            // including a match on blockInstruction.

            CompilerStack <Instruction> stack = FunctionBody.Root;

            for (int i = 0; i < stack.Count; i++)
            {
                if (stack.Peek() == blockInstruction)
                {
                    break;
                }

                // Push it into the block:
                blockInstruction.PrependInput(stack.Pop());
            }

            return(block);
        }
Пример #2
0
 /// <summary>Gets a labelled block by label index.</summary>
 public LabelledBlock GetBlock(int index)
 {
     return(BlockStack.Peek(index));
 }