Пример #1
0
        public void AddFirst(AstNode child)
        {
            if (child == null)
            {
                return;
            }

            if (this.children == null)
            {
                this.children = child;
                return;
            }

            // Add my children to the end of the list.
            AstNode lastChild = child;

            while (lastChild.GetNext() != null)
            {
                lastChild = lastChild.GetNext();
            }
            lastChild.SetNext(children);

            // Set the first.
            children = child;
        }
Пример #2
0
        public void AddLast(AstNode child)
        {
            if (child == null)
            {
                return;
            }

            if (this.children == null)
            {
                this.children = child;
                return;
            }

            AstNode lastChild = this.children;

            while (lastChild.GetNext() != null)
            {
                lastChild = lastChild.GetNext();
            }
            lastChild.SetNext(child);
        }
Пример #3
0
 protected void VisitList(AstNode list)
 {
     try
     {
         while (list != null)
         {
             list.Accept(this);
             list = list.GetNext();
         }
     }
     catch (System.SystemException sysException)
     {
         System.Console.WriteLine("Compiler bug near {0}", list.GetPosition().ToString());
         System.Console.WriteLine(sysException.ToString());
         System.Console.WriteLine(sysException.StackTrace);
         System.Environment.Exit(-1);
     }
 }
Пример #4
0
 protected void VisitList(AstNode list)
 {
     try
     {
         while(list != null)
         {
             list.Accept(this);
             list = list.GetNext();
         }
     }
     catch(System.SystemException sysException)
     {
         System.Console.WriteLine("Compiler bug near {0}", list.GetPosition().ToString());
         System.Console.WriteLine(sysException.ToString());
         System.Console.WriteLine(sysException.StackTrace);
         System.Environment.Exit(-1);
     }
 }