Add GenerateState to save code generate state.