/// <summary>Pushes a label onto the label stack.</summary> public LabelledBlock PushBlock(Type blockReturnType) { LabelledBlock block = new LabelledBlock(blockReturnType, Instruction); BlockStack.Push(block); return(block); }
/// <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); }
public BrTableImmediate(LabelledBlock[] table, LabelledBlock defaultTarget) { Labels = table; Default = defaultTarget; }