• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Qil.QilIterator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Xml.Xsl.Qil.QilIterator的典型用法代码示例。如果您正苦于以下问题:C# QilIterator类的具体用法?C# QilIterator怎么用?C# QilIterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



QilIterator类属于System.Xml.Xsl.Qil命名空间,在下文中一共展示了QilIterator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: AddVariable

 public void AddVariable(QilIterator let)
 {
     Debug.Assert(let.NodeType == QilNodeType.Let);
     _vars.Push(let);
 }
开发者ID:Corillian,项目名称:corefx,代码行数:5,代码来源:QilGenerator.cs


示例17: SetFocus

 public void SetFocus(QilIterator current)
 {
     _current = current;
     _cached = _last = null;
 }
开发者ID:geoffkizer,项目名称:corefx,代码行数:5,代码来源:Focus.cs


示例18: CheckFor

 //-----------------------------------------------
 // variables
 //-----------------------------------------------
 public XmlQueryType CheckFor(QilIterator node) {
     return node.Binding.XmlType.Prime;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:6,代码来源:QilTypeChecker.cs


示例19: FindFilterType

        private XmlQueryType FindFilterType(QilIterator variable, QilNode body) {
            XmlQueryType leftType;
            QilBinary binary;

            if (body.XmlType.TypeCode == XmlTypeCode.None)
                return XmlQueryTypeFactory.None;

            switch (body.NodeType) {
                case QilNodeType.False:
                    return XmlQueryTypeFactory.Empty;

                case QilNodeType.IsType:
                    // If testing the type of "variable", then filter type can be restricted
                    if ((object) ((QilTargetType) body).Source == (object) variable)
                        return XmlQueryTypeFactory.AtMost(((QilTargetType)body).TargetType, variable.Binding.XmlType.Cardinality);
                    break;

                case QilNodeType.And:
                    // Both And conditions can be used to restrict filter's type
                    leftType = FindFilterType(variable, ((QilBinary) body).Left);
                    if (leftType != null)
                        return leftType;

                    return FindFilterType(variable, ((QilBinary) body).Right);

                case QilNodeType.Eq:
                    // Restrict cardinality if position($iterator) = $pos is found
                    binary = (QilBinary) body;
                    if (binary.Left.NodeType == QilNodeType.PositionOf) {
                        if ((object) ((QilUnary) binary.Left).Child == (object) variable)
                            return XmlQueryTypeFactory.AtMost(variable.Binding.XmlType, XmlQueryCardinality.ZeroOrOne);
                    }
                    break;
            }

            return null;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:37,代码来源:QilTypeChecker.cs


示例20: VisitFor

 protected override QilNode VisitFor(QilIterator n) { return NoReplace(n); }
开发者ID:uQr,项目名称:referencesource,代码行数:1,代码来源:QilPatternVisitor.cs



注:本文中的System.Xml.Xsl.Qil.QilIterator类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Qil.QilList类代码示例发布时间:2022-05-26
下一篇:
C# Qil.QilBinary类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap