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; }
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); }
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); } }
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); } }