View over a Qil SortKey operator.
Don't construct QIL nodes directly; instead, use the QilFactory.
Inheritance: QilBinary
Ejemplo n.º 1
0
        public QilList SortKeyList(QilSortKey key)
        {
            QilList list = f.SortKeyList();

            list.Add(key);
            return(list);
        }
Ejemplo n.º 2
0
        public QilSortKey SortKey(QilNode key, QilNode collation)
        {
            QilSortKey n = new QilSortKey(QilNodeType.SortKey, key, collation);

            n.XmlType = this.typeCheck.CheckSortKey(n);
            TraceNode(n);
            return(n);
        }
Ejemplo n.º 3
0
 protected virtual QilNode VisitSortKey(QilSortKey n)
 {
     return(VisitChildren(n));
 }
 public QilList SortKeyList(QilSortKey key) {
     QilList list = f.SortKeyList();
     list.Add(key);
     return list;
 }
Ejemplo n.º 5
0
 public XmlQueryType CheckSortKey(QilSortKey node)
 {
     CheckAtomicX(node.Key);
     CheckXmlType(node.Collation, XmlQueryTypeFactory.StringX);
     return(node.Key.XmlType);
 }
Ejemplo n.º 6
0
 public XmlQueryType CheckSortKey(QilSortKey node) {
     CheckAtomicX(node.Key);
     CheckXmlType(node.Collation, XmlQueryTypeFactory.StringX);
     return node.Key.XmlType;
 }
Ejemplo n.º 7
0
 protected virtual QilNode VisitSortKey(QilSortKey n) { return VisitChildren(n); }
Ejemplo n.º 8
0
 protected override QilNode VisitSortKey(QilSortKey n) { return NoReplace(n); }
Ejemplo n.º 9
0
 protected override QilNode VisitSortKey(QilSortKey n)
 {
     return(NoReplace(n));
 }
 protected override QilNode VisitSortKey(QilSortKey local0) {
     QilNode local1 = local0[0];
     QilNode local2 = local0[1];
     if (this[XmlILOptimization.NormalizeSortXsltConvert]) {
         if (local1.NodeType == QilNodeType.XsltConvert) {
             QilNode local3 = local1[0];
             QilNode local4 = local1[1];
             if (local4.NodeType == QilNodeType.LiteralType) {
                 XmlQueryType local5 = (XmlQueryType)((QilLiteral)local4).Value;
                 if (( ( (local3).XmlType ) == ( XmlQueryTypeFactory.IntX ) ) && ( (local5) == ( XmlQueryTypeFactory.DoubleX ) )) {
                     if (AllowReplace(XmlILOptimization.NormalizeSortXsltConvert, local0)) {
                         return Replace(XmlILOptimization.NormalizeSortXsltConvert, local0, VisitSortKey(f.SortKey(local3, local2)));
                     }
                 }
             }
         }
     }
     return NoReplace(local0);
 }
Ejemplo n.º 11
0
 public QilSortKey SortKey(QilNode key, QilNode collation) {
     QilSortKey n = new QilSortKey(QilNodeType.SortKey, key, collation);
     n.XmlType = this.typeCheck.CheckSortKey(n);
     TraceNode(n);
     return n;
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Generate code to add a (value, collation) sort key to the XmlSortKeyAccumulator.
        /// </summary>
        private void VisitSortKey(QilSortKey ndKey, LocalBuilder locKeys)
        {
            Label lblOnEndKey;
            Debug.Assert(ndKey.Key.XmlType.IsAtomicValue, "Sort key must be an atomic value.");

            // Push collation onto the stack
            _helper.Emit(OpCodes.Ldloca, locKeys);
            if (ndKey.Collation.NodeType == QilNodeType.LiteralString)
            {
                // collation = runtime.GetCollation(idx);
                _helper.CallGetCollation(_helper.StaticData.DeclareCollation((string)(QilLiteral)ndKey.Collation));
            }
            else
            {
                // collation = runtime.CreateCollation(str);
                _helper.LoadQueryRuntime();
                NestedVisitEnsureStack(ndKey.Collation);
                _helper.Call(XmlILMethods.CreateCollation);
            }

            if (ndKey.XmlType.IsSingleton)
            {
                NestedVisitEnsureStack(ndKey.Key);

                // keys.AddSortKey(collation, value);
                _helper.AddSortKey(ndKey.Key.XmlType);
            }
            else
            {
                lblOnEndKey = _helper.DefineLabel();
                StartNestedIterator(ndKey.Key, lblOnEndKey);
                Visit(ndKey.Key);
                _iterCurr.EnsureStackNoCache();
                _iterCurr.EnsureItemStorageType(ndKey.Key.XmlType, GetItemStorageType(ndKey.Key));

                // Non-empty sort key
                // keys.AddSortKey(collation, value);
                _helper.AddSortKey(ndKey.Key.XmlType);

                // goto LabelDone;
                // LabelOnEnd:
                Label lblDone = _helper.DefineLabel();
                _helper.EmitUnconditionalBranch(OpCodes.Br_S, lblDone);
                _helper.MarkLabel(lblOnEndKey);

                // Empty sequence key
                // keys.AddSortKey(collation);
                _helper.AddSortKey(null);

                _helper.MarkLabel(lblDone);

                EndNestedIterator(ndKey.Key);
            }
        }
Ejemplo n.º 13
0
 protected override QilNode VisitSortKey(QilSortKey local0)
 {
     QilNode local1 = local0[0];
     QilNode local2 = local0[1];
     if (this[XmlILOptimization.NormalizeSortXsltConvert])
     {
         if (local1.NodeType == QilNodeType.XsltConvert)
         {
             QilNode local3 = local1[0];
             QilNode local4 = local1[1];
             if (local4.NodeType == QilNodeType.LiteralType)
             {
                 XmlQueryType local5 = (XmlQueryType)((QilLiteral)local4).Value;
                 if ((((local3).XmlType) == (XmlQueryTypeFactory.IntX)) && ((local5) == (XmlQueryTypeFactory.DoubleX)))
                 {
                     // PATTERN: [NormalizeSortXsltConvert] (SortKey (XsltConvert $expr:* (LiteralType $typ:*)) ^ (Equal? (TypeOf $expr) (ConstructType {IntX})) ^ (Equal? $typ (ConstructType {DoubleX})) $coll:*) => (SortKey $expr $coll)
                     if (AllowReplace(XmlILOptimization.NormalizeSortXsltConvert, local0))
                     {
                         return Replace(XmlILOptimization.NormalizeSortXsltConvert, local0, VisitSortKey(f.SortKey(local3, local2)));
                     }
                 }
             }
         }
     }
     return NoReplace(local0);
 }