/// <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); }
/// <summary>Gets a labelled block by label index.</summary> public LabelledBlock GetBlock(int index) { return(BlockStack.Peek(index)); }