The thing is, XPathNodeIterator itself is stateful and does not behave
like IEnumerable, thus GetEnumerator() should not iterate nodes within
*itself*. Rather, it should have returned a clone of it.
After all we didn't have to damage performance to fix bug #3705, which is nice.
Adding a test case for ancestor-or-self along the lines of the existing one for ancestor showed runaway, memory-eating behaviour. In changing CollectResults to remove the livelock, it seemed simplest to remove the extra yield of the root from MoveNextCore. I was unable to ascertain a good reason for producing this element in this special way compared to the AncestorIterator.
* Iterator.cs : DescendantIterator.Clone() was not cloning current
node in new code. Fixed bug #456103.
* XPathNavigatorTests.cs : added test fo bug #456103.
svn path=/trunk/mcs/; revision=121080
* Iterator.cs : be more strict to detect the end of
PredicateIterator. Fixed bug #349111.
* XslTransformTests.cs : added test for bug #349111.
svn path=/trunk/mcs/; revision=91405
* Iterator.cs : seems like MS XPathNodeIterator.MoveNext() itself does
not handle XsltContext.PreserveWhitespace() unlike ours. It results
in not a small performance improvement. (just removed it since it
didn't cause any errors in XSLT standalone tests.)
svn path=/trunk/mcs/; revision=57298
* Iterator.cs : Nowadays removal of cloning of the argument list
in ListIterator is safe. Thanks to Joshua Tauberer for the hint.
svn path=/trunk/mcs/; revision=55394
* Iterator.cs : (DescendantOrSelfIterator/DescendantIterator)
the error message is for blaming custom XPathNavigator
implementation, not us ;-) (see also #77194)
svn path=/trunk/mcs/; revision=55389
* DefaultContext.cs,
Expression.cs,
Iterator.cs : Now RequireSorting is not required in BaseIterator
(it is now fully in Expression).
Removed the last ListIterator .ctor() argument.
* XslKey.cs : removed last ListIterator.ctor() argument.
Reverted the last commit that changed internal key index change
from ArrayList to Hashtable. Avoid clone in CollectIndex().
Sort results in Evaluate() before passing list to ListIterator.
* XslFunctions.cs : removed last ListIterator.ctor() argument.
* XslVariable.cs : removed last ListIterator.ctor() argument.
svn path=/trunk/mcs/; revision=41864
* 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
* XslVariable.cs : clone stored XPathNavigator items before storing.
* XslAttribute.cs : tiny code reduction.
* Iterator.cs : Now for most of iterator types, Current property always
returns the same instance. It results in huge memory reduction.
svn path=/trunk/mcs/; revision=41591
* Iterator.cs : (SlashIterator.MoveNext()) For SortedList.Add(), the
key should be iterator itself. Key by list count never makes sense.
svn path=/trunk/mcs/; revision=41556
* Iterator.cs :
In FollowingIterator, attribute and namespace nodes should be
considered to have following nodes. See XPath 1.0 section 5 (esp.
the description on "document order").
On fixing @*/following::*, attribute nodes are regarded as to be
RequireSorting = true (which might result in duplicate).
svn path=/trunk/mcs/; revision=41074
* Iterator.cs : when PredicateIterator has a numeric predicate, it
will never be true twice. So just break up the iteration on true.
* XPathNavigator.cs : implemented LookupPrefix().
* Expression.cs : ExprParens.Optimize() could just return the content
expression.
svn path=/trunk/mcs/; revision=36944
* Iterator.cs : Create _current clone only when required. So just set
null when MoveNextCore() succeeded (except for some cases that
_current is _nav, such as SelfIterator).
svn path=/trunk/mcs/; revision=36879
* Iterator.cs : SlashIterator.RequireSorting is always false. Whether
it has to collect nodes in prior or not and whether it might return
nodes in inconsistent order is different matter.
(It still needs to store nodes when either of branches requires
sorting, because they might return the same node later.)
svn path=/trunk/mcs/; revision=36850
* Iterator.cs : reduced some extraneous ComparePosition() that could
be written as IsSamePosition(). ParentIterator doesn't have to be
RequireSorting.
svn path=/trunk/mcs/; revision=36848
* Iterator.cs : reimplemented AncestorIterator and
AncestorOrSelfIterator just to collect parents and not to move to
siblings. In some cases like thousands of siblings, it used to be
so slow, while we usually don't have so deep ancestors.
svn path=/trunk/mcs/; revision=36847
* Iterator.cs :
- Made copy constructor certainly different from other constructors.
- Position is never computed in each derived type. All MoveNext() are
now MoveNextCore().
- Most of the protected members could just be private.
svn path=/trunk/mcs/; revision=35776
* Iterator.cs :
- Added WrapperIterator to return BaseIterator in such case that
variable reference is resolved to XPathNodeIterator. This fixes
bug #68267.
- Path ".." is reverse axis (actually no effect).
- Fixed DescendantIterator.Clone() that missed "_finished" field.
* Expression.cs :
In ExprVariable.Evaluate(), use WrapperIterator() for custom
XPathNodeIterator.
svn path=/trunk/mcs/; revision=34996
* Iterator.cs : Added overriden Count properties for some iterators
(this fixes the half of #50678).
Added ListIterator class (which can reduce GetEnumerator()).
In some places we can omit clone for Current property, so added
some check logic (It has no effect as yet).
* Expression.cs, DefaultContext.cs :
use ListIterator instead of EnumeratorIterator.
svn path=/trunk/mcs/; revision=22934
* DefaultContext.cs : Avoid exception if possible.
* Iterator.cs : Fixed PrecedingSiblingIterator.MoveNext(). When the
nav was positioned at the first, it incorrectly points itself.
Don't add names to name table while it is useless and expensive.
svn path=/trunk/mcs/; revision=22544
* Iterator.cs : On its iteration, moving Current must not affect to
MoveNext(). To assure this, Current must be a clone of navigator.
Removed unused code.
svn path=/trunk/mcs/; revision=21225