Project

Profile

Help

Revision f510647f

Added by Michael Kay over 2 years ago

Fix bug #4298

View differences:

latest9.9/hej/net/sf/saxon/expr/HomogeneityChecker.java
12 12
import net.sf.saxon.expr.parser.ExpressionVisitor;
13 13
import net.sf.saxon.expr.parser.RebindingMap;
14 14
import net.sf.saxon.expr.sort.DocumentSorter;
15
import net.sf.saxon.om.Item;
16 15
import net.sf.saxon.om.SequenceIterator;
17 16
import net.sf.saxon.pattern.AnyNodeTest;
18 17
import net.sf.saxon.trans.XPathException;
......
55 54
        int rel = th.relationship(type, AnyNodeTest.getInstance());
56 55
        if (rel == TypeHierarchy.DISJOINT) {
57 56
            // expression cannot return nodes, so this checker is redundant
58
            if (getBaseExpression() instanceof SlashExpression && ((SlashExpression) getBaseExpression()).getLeadingSteps() instanceof SlashExpression &&
59
                    (((SlashExpression) getBaseExpression()).getLeadingSteps().getSpecialProperties() & StaticProperty.ORDERED_NODESET) == 0) {
60
                DocumentSorter ds = new DocumentSorter(((SlashExpression) getBaseExpression()).getLeadingSteps());
61
                SlashExpression se = new SlashExpression(ds, ((SlashExpression) getBaseExpression()).getLastStep());
62
                ExpressionTool.copyLocationInfo(this, se);
63
                return se;
64
            } else {
57
//            if (getBaseExpression() instanceof SlashExpression && ((SlashExpression) getBaseExpression()).getLeadingSteps() instanceof SlashExpression &&
58
//                    (((SlashExpression) getBaseExpression()).getLeadingSteps().getSpecialProperties() & StaticProperty.ORDERED_NODESET) == 0) {
59
//                DocumentSorter ds = new DocumentSorter(((SlashExpression) getBaseExpression()).getLeadingSteps());
60
//                SlashExpression se = new SlashExpression(ds, ((SlashExpression) getBaseExpression()).getLastStep());
61
//                ExpressionTool.copyLocationInfo(this, se);
62
//                return se;
63
//            } else {
65 64
                return getBaseExpression();
66
            }
65
//            }
67 66
        } else if (rel == TypeHierarchy.SAME_TYPE || rel == TypeHierarchy.SUBSUMED_BY) {
68 67
            // expression always returns nodes, so replace this expression with a DocumentSorter
69 68
            Expression savedBase = getBaseExpression();

Also available in: Unified diff