gmCodeGenPrivate::FunctionState * gmCodeGenPrivate::PopFunction() { if(m_currentFunction) { m_currentFunction->Reset(); m_currentFunction = m_functionStack.GetPrev(m_currentFunction); if(!m_functionStack.IsValid(m_currentFunction)) { m_currentFunction = NULL; } } return m_currentFunction; }
gmCodeGenPrivate::FunctionState * gmCodeGenPrivate::PushFunction() { if(m_currentFunction) { if(m_currentFunction != m_functionStack.GetLast()) { m_currentFunction = m_functionStack.GetNext(m_currentFunction); } else { m_currentFunction = GM_NEW( FunctionState() ); m_functionStack.InsertLast(m_currentFunction); } } else { if(m_functionStack.IsEmpty()) { m_currentFunction = GM_NEW( FunctionState() ); m_functionStack.InsertLast(m_currentFunction); } else { m_currentFunction = m_functionStack.GetFirst(); } } m_currentFunction->Reset(); m_currentFunction->m_byteCode.SetSwapEndianOnWrite(m_hooks->SwapEndian()); // if we are debugging, set up some line number debugging. if(m_debug) { m_currentFunction->m_byteCode.m_emitCallback = gmLineNumberCallback; } return m_currentFunction; }