コード例 #1
0
ファイル: Focus.cs プロジェクト: rsumner31/corefx2
 public void Sort(QilNode sortKeys)
 {
     if (sortKeys != null)
     {
         // If sorting is required, cache the input node-set to support last() within sort key expressions
         EnsureCache();
         // The rest of the loop content must be compiled in the context of already sorted node-set
         _current = _f.For(_f.Sort(_current, sortKeys));
     }
 }
コード例 #2
0
 // Filers that travers Content being converted to global travers:
 // Filter($j= ... Filter($i = Content(fixup), ...))  -> Filter($j= ... Filter($i = Loop($j = DesendentOrSelf(Root(fixup)), Content($j), ...)))
 protected override QilNode VisitLoop(QilLoop n)
 {
     if (n.Variable.Binding.NodeType == QilNodeType.Root || n.Variable.Binding.NodeType == QilNodeType.Deref)
     {
         // This is absolute path already. We shouldn't touch it
         return(n);
     }
     if (n.Variable.Binding.NodeType == QilNodeType.Content)
     {
         // This is "begin" of reletive path. Let's rewrite it as absolute:
         QilUnary content = (QilUnary)n.Variable.Binding;
         Debug.Assert(content.Child == this.fixup, "Unexpected content node");
         QilIterator it = f.For(f.DescendantOrSelf(f.Root(this.fixup)));
         content.Child      = it;
         n.Variable.Binding = f.Loop(it, content);
         return(n);
     }
     n.Variable.Binding = Visit(n.Variable.Binding);
     return(n);
 }