// Call at the end of compilation to revert the stack to the state at the beginning of complilation, // as well as finalize or revert any types added during compilation. public void FinishCompile(bool revert) { stack.RestoreState(_preCompileState.stackState); if (revert) { #if PEBBLE_TRACETYPES engine.Log("Reverting " + _types.BufferedCount() + " types."); engine.Log("Reverting " + _classes.BufferedCount() + " classes."); #endif _types.Revert(); _classes.Revert(); } else { #if PEBBLE_TRACETYPES engine.Log("Applying " + _types.BufferedCount() + " types."); engine.Log("Applying " + _classes.BufferedCount() + " classes."); #endif _types.Apply(); _classes.Apply(); } control.Clear(); _preCompileState = null; }
// Call at the beginning of compilation to save current state. public void BeginCompile() { Pb.Assert(null == _preCompileState); _preCompileState = new PreCompileState(); _preCompileState.stackState = stack.GetState(); _types.Apply(); _classes.Apply(); }