Browse Source

2004-03-09 Atsushi Enomoto <[email protected]>

	* Expression.cs,
	  Iterator.cs, :
	  SlashIterator is now constructed with requireSorting parameter 
	  that thus just use RequireSorting from both left/right Expressions, 
	  not iterators.
	  When attribute axis is on the left expression, the result needs to
	  be sorted.


svn path=/trunk/mcs/; revision=41614
Atsushi Eno 21 years ago
parent
commit
8584919df5

+ 10 - 0
mcs/class/System.XML/System.Xml.XPath/ChangeLog

@@ -1,3 +1,13 @@
+2004-03-09  Atsushi Enomoto  <[email protected]>
+
+	* Expression.cs,
+	  Iterator.cs, :
+	  SlashIterator is now constructed with requireSorting parameter 
+	  that thus just use RequireSorting from both left/right Expressions, 
+	  not iterators.
+	  When attribute axis is on the left expression, the result needs to
+	  be sorted.
+
 2004-03-09  Atsushi Enomoto  <[email protected]>
 
 	* Iterator.cs : Now for most of iterator types, Current property always

+ 6 - 3
mcs/class/System.XML/System.Xml.XPath/Expression.cs

@@ -984,7 +984,7 @@ namespace System.Xml.XPath
 		public override object Evaluate (BaseIterator iter)
 		{
 			BaseIterator iterLeft = left.EvaluateNodeSet (iter);
-			return new SlashIterator (iterLeft, right);
+			return new SlashIterator (iterLeft, right, left.RequireSorting || right.RequireSorting);
 		}
 
 		public override bool RequireSorting { get { return left.RequireSorting || right.RequireSorting; } }
@@ -1019,9 +1019,11 @@ namespace System.Xml.XPath
 			return new SlashIterator (
 				new SlashIterator (
 					left.EvaluateNodeSet (iter),
-					DescendantOrSelfStar
+					DescendantOrSelfStar,
+					left.RequireSorting || DescendantOrSelfStar.RequireSorting
 				),
-				right
+				right,
+				DescendantOrSelfStar.RequireSorting || right.RequireSorting
 			);
 		}
 
@@ -1193,6 +1195,7 @@ namespace System.Xml.XPath
 				case Axes.AncestorOrSelf:
 				case Axes.Preceding:
 				case Axes.PrecedingSibling:
+				case Axes.Attribute:
 				case Axes.Namespace:
 					return true;
 				default:

+ 2 - 2
mcs/class/System.XML/System.Xml.XPath/Iterator.cs

@@ -841,12 +841,12 @@ namespace System.Xml.XPath
 		bool _finished;
 		BaseIterator _nextIterRight;
 
-		public SlashIterator (BaseIterator iter, NodeSet expr) : base (iter.NamespaceManager)
+		public SlashIterator (BaseIterator iter, NodeSet expr, bool requireSorting) : base (iter.NamespaceManager)
 		{
 			_iterLeft = iter;
 			_expr = expr;
 
-			if (_iterLeft.RequireSorting || _expr.RequireSorting)
+			if (requireSorting)
 				CollectResults ();
 		}