Exemple #1
0
        public void ExitBlock()
        {
            DeIndent();
            int previousStackSize = StackIndices.Pop();

            if (!RestOfBlockUnreachable)
            {
                Debug.Assert(Stack.Count <= previousStackSize + 1);
            }

            RestOfBlockUnreachable = false;

            while (Stack.Count > previousStackSize)
            {
                Stack.Pop();
            }
        }
Exemple #2
0
 public void EnterBlock()
 {
     Indent();
     StackIndices.Push(Stack.Count);
 }
Exemple #3
0
 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());
 }