[Monodevelop-patches-list] r464 - trunk/MonoDevelop/src/Libraries/SharpRefactory/src/Parser/AST

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Sun Jan 11 21:08:07 EST 2004


Author: benm
Date: 2004-01-11 21:08:07 -0500 (Sun, 11 Jan 2004)
New Revision: 464

Modified:
   trunk/MonoDevelop/src/Libraries/SharpRefactory/src/Parser/AST/AbstractNode.cs
Log:
smaller array lists

Modified: trunk/MonoDevelop/src/Libraries/SharpRefactory/src/Parser/AST/AbstractNode.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/SharpRefactory/src/Parser/AST/AbstractNode.cs	2004-01-12 02:07:38 UTC (rev 463)
+++ trunk/MonoDevelop/src/Libraries/SharpRefactory/src/Parser/AST/AbstractNode.cs	2004-01-12 02:08:07 UTC (rev 464)
@@ -26,7 +26,7 @@
 	public abstract class AbstractNode : INode
 	{
 		INode     parent;
-		ArrayList children = new ArrayList();
+		ArrayList children;
 		Hashtable specials;
 		Point     startLocation;
 		Point     endLocation;
@@ -68,13 +68,18 @@
 		}
 		
 		public ArrayList Children {
-			get {
+			get {
+				if (children == null)
+					return children = new ArrayList (1);
 				return children;
 			}
 		}
 		
 		public virtual void AddChild(INode childNode)
-		{
+		{
+			if (children == null)
+				children = new ArrayList ();
+			
 			children.Add(childNode);
 		}
 		
@@ -84,7 +89,10 @@
 		}
 		
 		public object AcceptChildren(IASTVisitor visitor, object data)
-		{
+		{
+			if (children == null)
+				return data;
+			
 			foreach (INode child in children) {
 				if (child != null) {
 					child.AcceptVisitor(visitor, data);




More information about the Monodevelop-patches-list mailing list