當前位置: 首頁>>代碼示例>>C#>>正文


C# Qil.QilIterator類代碼示例

本文整理匯總了C#中System.Xml.Xsl.Qil.QilIterator的典型用法代碼示例。如果您正苦於以下問題:C# QilIterator類的具體用法?C# QilIterator怎麽用?C# QilIterator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


QilIterator類屬於System.Xml.Xsl.Qil命名空間,在下文中一共展示了QilIterator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetFocus

 public void SetFocus(QilIterator current) {
     if (current != null) {
         this.focusType = SingletonFocusType.Iterator;
         this.current   = current;
     } else {
         this.focusType = SingletonFocusType.None;
         this.current   = null;
     }
 }
開發者ID:gbarnett,項目名稱:shared-source-cli-2.0,代碼行數:9,代碼來源:focus.cs

示例2: StartForBinding

        /// <summary>
        /// Bind values produced by the "ndFor" expression to a non-stack location that can later
        /// be referenced.
        /// </summary>
        private void StartForBinding(QilIterator ndFor, OptimizerPatterns patt)
        {
            LocalBuilder locPos = null;
            Debug.Assert(ndFor.XmlType.IsSingleton);

            // For expression iterator will be unnested as part of parent iterator
            if (_iterCurr.HasLabelNext)
                StartNestedIterator(ndFor.Binding, _iterCurr.GetLabelNext());
            else
                StartNestedIterator(ndFor.Binding);

            if (patt.MatchesPattern(OptimizerPatternName.IsPositional))
            {
                // Need to track loop index so initialize it to 0 before starting loop
                locPos = _helper.DeclareLocal("$$$pos", typeof(int));
                _helper.Emit(OpCodes.Ldc_I4_0);
                _helper.Emit(OpCodes.Stloc, locPos);
            }

            // Allow base internal class to dispatch based on QilExpression node type
            Visit(ndFor.Binding);

            // DebugInfo: Open variable scope
            // DebugInfo: Ensure that for variable is stored in a local and tag it with the user-defined name
            if (_qil.IsDebug && ndFor.DebugName != null)
            {
                _helper.DebugStartScope();

                // Ensure that values are stored in a local variable with a user-defined name
                _iterCurr.EnsureLocalNoCache("$$$for");
            }
            else
            {
                // Ensure that values are not stored on the stack
                _iterCurr.EnsureNoStackNoCache("$$$for");
            }

            if (patt.MatchesPattern(OptimizerPatternName.IsPositional))
            {
                // Increment position
                _helper.Emit(OpCodes.Ldloc, locPos);
                _helper.Emit(OpCodes.Ldc_I4_1);
                _helper.Emit(OpCodes.Add);
                _helper.Emit(OpCodes.Stloc, locPos);

                if (patt.MatchesPattern(OptimizerPatternName.MaxPosition))
                {
                    // Short-circuit rest of loop if max position has already been reached
                    _helper.Emit(OpCodes.Ldloc, locPos);
                    _helper.LoadInteger((int)patt.GetArgument(OptimizerPatternArgument.MaxPosition));
                    _helper.Emit(OpCodes.Bgt, _iterCurr.ParentIterator.GetLabelNext());
                }

                _iterCurr.LocalPosition = locPos;
            }

            EndNestedIterator(ndFor.Binding);
            _iterCurr.SetIterator(_iterNested);
        }
開發者ID:Corillian,項目名稱:corefx,代碼行數:63,代碼來源:XmlIlVisitor.cs

示例3: Filter

 public QilNode Filter(QilIterator variable, QilNode expr) {
     if (! debug) {
         //((Filter (For $Binding) (True ) ) => ($binding))
         if (expr.NodeType == QilNodeType.True) {
             return variable.Binding;
         }
         // The following optimization is not safe if the iterator has side effects
         //((Filter (For $Binding) (False) ) => (Sequence))
     }
     return f.Filter(variable, expr);
 }
開發者ID:krytht,項目名稱:DotNetReferenceSource,代碼行數:11,代碼來源:QilPatternFactory.cs

示例4: PositionOf

 public QilNode PositionOf(QilIterator expr) {
     return f.PositionOf(expr);
 }
開發者ID:krytht,項目名稱:DotNetReferenceSource,代碼行數:3,代碼來源:QilPatternFactory.cs

示例5: CheckLet

 public XmlQueryType CheckLet(QilIterator node) {
     return node.Binding.XmlType;
 }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:3,代碼來源:QilTypeChecker.cs

示例6: CompileSingleKey

        private QilNode CompileSingleKey(List<Key> defList, QilIterator key, QilIterator context) {
            Debug.Assert(defList != null && defList.Count > 0);
            QilList result = f.BaseFactory.Sequence();
            QilNode keyRef = null;

            foreach (Key keyDef in defList) {
                keyRef = f.Invoke(keyDef.Function, f.ActualParameterList(context, key));
                result.Add(keyRef);
            }
            return defList.Count == 1 ? keyRef : result;
        }
開發者ID:gbarnett,項目名稱:shared-source-cli-2.0,代碼行數:11,代碼來源:qilgeneratorenv.cs

示例7: MatchCountPattern

        private QilNode MatchCountPattern(QilNode countPattern, QilIterator testNode)
        {
            /*
                If the 'count' attribute is not specified, then it defaults to the pattern that matches any node
                with the same node kind as the context node and, if the context node has an expanded-QName, with
                the same expanded-QName as the context node.
            */
            if (countPattern != null)
            {
                return MatchPattern(countPattern, testNode);
            }
            else
            {
                QilNode current = GetCurrentNode();
                QilNode result;
                XmlNodeKindFlags nodeKinds = current.XmlType.NodeKinds;

                // If node kind is not known, invoke a runtime function
                if ((nodeKinds & (nodeKinds - 1)) != 0)
                {
                    return _f.InvokeIsSameNodeSort(testNode, current);
                }

                // Otherwise generate IsType check along with expanded QName check
                switch (nodeKinds)
                {
                    case XmlNodeKindFlags.Document: return _f.IsType(testNode, T.Document);
                    case XmlNodeKindFlags.Element: result = _f.IsType(testNode, T.Element); break;
                    case XmlNodeKindFlags.Attribute: result = _f.IsType(testNode, T.Attribute); break;
                    case XmlNodeKindFlags.Text: return _f.IsType(testNode, T.Text);
                    case XmlNodeKindFlags.Comment: return _f.IsType(testNode, T.Comment);
                    case XmlNodeKindFlags.PI: return _f.And(_f.IsType(testNode, T.PI), _f.Eq(_f.LocalNameOf(testNode), _f.LocalNameOf(current)));
                    case XmlNodeKindFlags.Namespace: return _f.And(_f.IsType(testNode, T.Namespace), _f.Eq(_f.LocalNameOf(testNode), _f.LocalNameOf(current)));
                    default:
                        Debug.Fail("Unexpected NodeKind: " + nodeKinds.ToString());
                        return _f.False();
                }

                // Elements and attributes have both local name and namespace URI
                return _f.And(result, _f.And(
                    _f.Eq(_f.LocalNameOf(testNode), _f.LocalNameOf(current)),
                    _f.Eq(_f.NamespaceUriOf(testNode), _f.NamespaceUriOf(GetCurrentNode()))
                ));
            }
        }
開發者ID:Corillian,項目名稱:corefx,代碼行數:45,代碼來源:QilGenerator.cs

示例8: MatchPattern

        private QilNode MatchPattern(QilNode pattern, QilIterator testNode)
        {
            QilList list;
            if (pattern.NodeType == QilNodeType.Error)
            {
                // Invalid pattern
                return pattern;
            }
            else if (pattern.NodeType == QilNodeType.Sequence)
            {
                list = (QilList)pattern;
                Debug.Assert(0 < list.Count, "Pattern should have at least one filter");
            }
            else
            {
                list = _f.BaseFactory.Sequence();
                list.Add(pattern);
            }

            QilNode result = _f.False();
            for (int i = list.Count - 1; 0 <= i; i--)
            {
                QilLoop filter = (QilLoop)list[i];
                _ptrnBuilder.AssertFilter(filter);
                result = _f.Or(
                    _refReplacer.Replace(filter.Body, filter.Variable, testNode),
                    result
                );
            }
            return result;
        }
開發者ID:Corillian,項目名稱:corefx,代碼行數:31,代碼來源:QilGenerator.cs

示例9: IsGlobalVariable

 /// <summary>
 /// True if the specified iterator is a global variable Let iterator.
 /// </summary>
 private bool IsGlobalVariable(QilIterator iter) {
     return this.qil.GlobalVariableList.Contains(iter);
 }
開發者ID:gbarnett,項目名稱:shared-source-cli-2.0,代碼行數:6,代碼來源:xmliloptimizervisitor.cs

示例10: VisitLet

        protected override QilNode VisitLet(QilIterator local0) {
            QilNode local1 = local0[0];
            if ((( ( (local0).XmlType ).IsSingleton ) && (!( IsGlobalVariable(local0) ))) && (this[XmlILOptimization.NormalizeSingletonLet])) {
                if (AllowReplace(XmlILOptimization.NormalizeSingletonLet, local0)) {
                    
    local0.NodeType = QilNodeType.For;
    VisitFor(local0);
}
            }
            if (this[XmlILOptimization.AnnotateLet]) {
                if (AllowReplace(XmlILOptimization.AnnotateLet, local0)) {
                     OptimizerPatterns.Inherit((QilNode) (local1), (QilNode) (local0), OptimizerPatternName.Step);  OptimizerPatterns.Inherit((QilNode) (local1), (QilNode) (local0), OptimizerPatternName.IsDocOrderDistinct);  OptimizerPatterns.Inherit((QilNode) (local1), (QilNode) (local0), OptimizerPatternName.SameDepth);  }
            }
            return NoReplace(local0);
        }
開發者ID:gbarnett,項目名稱:shared-source-cli-2.0,代碼行數:15,代碼來源:xmliloptimizervisitor.cs

示例11: Let

 public QilIterator Let(QilNode binding) {
     QilIterator n = new QilIterator(QilNodeType.Let, binding);
     n.XmlType = this.typeCheck.CheckLet(n);
     TraceNode(n);
     return n;
 }
開發者ID:krytht,項目名稱:DotNetReferenceSource,代碼行數:6,代碼來源:QilFactory.cs

示例12: EndBinding

        /// <summary>
        /// Mark iterator variables as out-of-scope.
        /// </summary>
        private void EndBinding(QilIterator ndIter)
        {
            Debug.Assert(ndIter != null);

            // Variables go out of scope here
            if (_qil.IsDebug && ndIter.DebugName != null)
                _helper.DebugEndScope();
        }
開發者ID:Corillian,項目名稱:corefx,代碼行數:11,代碼來源:XmlIlVisitor.cs

示例13: StartLetBinding

        /// <summary>
        /// Bind values in the "ndLet" expression to a non-stack location that can later be referenced.
        /// </summary>
        public void StartLetBinding(QilIterator ndLet)
        {
            Debug.Assert(!ndLet.XmlType.IsSingleton);

            // Construct nested iterator
            StartNestedIterator(ndLet);

            // Allow base internal class to dispatch based on QilExpression node type
            NestedVisit(ndLet.Binding, GetItemStorageType(ndLet), !ndLet.XmlType.IsSingleton);

            // DebugInfo: Open variable scope
            // DebugInfo: Ensure that for variable is stored in a local and tag it with the user-defined name
            if (_qil.IsDebug && ndLet.DebugName != null)
            {
                _helper.DebugStartScope();

                // Ensure that cache is stored in a local variable with a user-defined name
                _iterCurr.EnsureLocal("$$$cache");
            }
            else
            {
                // Ensure that cache is not stored on the stack
                _iterCurr.EnsureNoStack("$$$cache");
            }

            EndNestedIterator(ndLet);
        }
開發者ID:Corillian,項目名稱:corefx,代碼行數:30,代碼來源:XmlIlVisitor.cs

示例14: VisitLet

 protected virtual QilNode VisitLet(QilIterator n) { return VisitChildren(n); }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:1,代碼來源:QilVisitor.cs

示例15: VisitLetReference

 protected virtual QilNode VisitLetReference(QilIterator n) { return n; }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:1,代碼來源:QilVisitor.cs


注:本文中的System.Xml.Xsl.Qil.QilIterator類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。