public void ExitBlock() { DeIndent(); int previousStackSize = StackIndices.Pop(); if (!RestOfBlockUnreachable) { Debug.Assert(Stack.Count <= previousStackSize + 1); } RestOfBlockUnreachable = false; while (Stack.Count > previousStackSize) { Stack.Pop(); } }
public void EnterBlock() { Indent(); StackIndices.Push(Stack.Count); }
public Variable Pop() { Debug.Assert(Stack.Any(), "Tried to pop a value from an empty stack"); Debug.Assert(Stack.Count > StackIndices.Peek(), $"Pop causes stack size to becomes less than {StackIndices.Count}, which is the minimum for this block"); return(Stack.Pop()); }