System.Xml.Xsl.Xslt.XPathPatternBuilder.JoinStep C# (CSharp) Method

JoinStep() public method

public JoinStep ( QilNode left, QilNode right ) : QilNode
left QilNode
right QilNode
return QilNode
        public QilNode JoinStep(QilNode left, QilNode right) {
            Debug.Assert(left  != null);
            Debug.Assert(right != null);
            if (left.NodeType == QilNodeType.Nop) {
                QilUnary nop = (QilUnary)left;
                Debug.Assert(nop.Child == this.fixupNode);
                nop.Child = right;  // We use Nop as a flag that DescendantOrSelf axis was used between steps.
                return nop;
            }
            Debug.Assert(GetLastParent(left) == left, "Left is always single axis and never the step");
            Debug.Assert(left.NodeType == QilNodeType.Filter);
            CleanAnnotation(left);
            QilLoop parentFilter = (QilLoop) left;
            bool ancestor = false; {
                if (right.NodeType == QilNodeType.Nop) {
                    ancestor = true;
                    QilUnary nop = (QilUnary)right;
                    Debug.Assert(nop.Child != null);
                    right = nop.Child;
                }
            }
            Debug.Assert(right.NodeType == QilNodeType.Filter);
            QilLoop lastParent = GetLastParent(right);
            FixupFilterBinding(parentFilter, ancestor ? f.Ancestor(lastParent.Variable) : f.Parent(lastParent.Variable));
            lastParent.Body = f.And(lastParent.Body, f.Not(f.IsEmpty(parentFilter)));
            SetPriority(right, 0.5);
            SetLastParent(right, parentFilter);
            return right;
        }