Ejemplo n.º 1
0
        private void PushNewScope(Scope newScope, string nameOfNewMemorySpace, AST startNode)
        {
                        #if DEBUG
            Debug.Assert(newScope != null);
            Debug.Assert(startNode != null);
                        #endif

            if (m_memorySpaceStack.Count > 100)
            {
                var token = startNode.getToken();
                throw new Error("Stack overflow!", Error.ErrorType.RUNTIME, token.LineNr, token.LinePosition);
            }

            m_currentScope = newScope;
            m_memorySpaceStack.Push(m_currentMemorySpace);

            m_currentMemorySpace = new MemorySpace(nameOfNewMemorySpace, startNode, m_currentScope, m_memorySpaceNodeListCache);
            m_currentScope.PushMemorySpace(m_currentMemorySpace);

#if LOG_SCOPES
            //m_currentMemorySpace.TraceParentScopes();
            //Console.WriteLine("Pushed new scope " + newScope.getName() + " with memory space " + m_currentMemorySpace.getName() + ", stack: " + DumpStack());
            //Console.WriteLine("CREATED " + m_currentMemorySpace.getName());
            nrOfScopes++;
#endif
        }
Ejemplo n.º 2
0
        private void PushNewScope(Scope newScope, string nameOfNewMemorySpace, AST startNode)
        {
            Debug.Assert(newScope != null);
            Debug.Assert(startNode != null);
#if WRITE_DEBUG_INFO
            Console.WriteLine("Pushed new scope " + newScope.getName());
#endif
            m_currentScope = newScope;
            m_memorySpaceStack.Push(m_currentMemorySpace);
            m_currentMemorySpace = new MemorySpace(nameOfNewMemorySpace, startNode, m_currentScope, m_memorySpaceNodeListCache);
            m_currentScope.PushMemorySpace(m_currentMemorySpace);
        }