View over a Qil operator having N children.
Don't construct QIL nodes directly; instead, use the QilFactory.
Inheritance: QilNode
コード例 #1
0
        public QilList Sequence(IList <QilNode> values)
        {
            QilList seq = Sequence();

            seq.Add(values);
            return(seq);
        }
コード例 #2
0
        public QilList FormalParameterList(IList <QilNode> values)
        {
            QilList seq = FormalParameterList();

            seq.Add(values);
            return(seq);
        }
コード例 #3
0
        public QilList SortKeyList(IList <QilNode> values)
        {
            QilList seq = SortKeyList();

            seq.Add(values);
            return(seq);
        }
コード例 #4
0
        public QilList BranchList(IList <QilNode> values)
        {
            QilList seq = BranchList();

            seq.Add(values);
            return(seq);
        }
コード例 #5
0
        public QilList FunctionList(IList <QilNode> values)
        {
            QilList seq = FunctionList();

            seq.Add(values);
            return(seq);
        }
コード例 #6
0
        public QilList GlobalVariableList(IList <QilNode> values)
        {
            QilList seq = GlobalVariableList();

            seq.Add(values);
            return(seq);
        }
コード例 #7
0
        public QilNode XsltInvokeEarlyBound(QilNode name, MethodInfo d, XmlQueryType t, IList <QilNode> args)
        {
            QilList list = f.ActualParameterList();

            list.Add(args);
            return(f.XsltInvokeEarlyBound(name, f.LiteralObject(d), list, t));
        }
コード例 #8
0
        public QilNode XsltInvokeLateBound(QilNode name, IList <QilNode> args)
        {
            QilList list = f.ActualParameterList();

            list.Add(args);
            return(f.XsltInvokeLateBound(name, list));
        }
コード例 #9
0
        public QilList FormalParameterList(QilNode arg1)
        {
            QilList result = f.FormalParameterList();

            result.Add(arg1);
            return(result);
        }
コード例 #10
0
        public QilList SortKeyList(QilSortKey key)
        {
            QilList list = f.SortKeyList();

            list.Add(key);
            return(list);
        }
コード例 #11
0
        public QilList ActualParameterList(QilNode arg1)
        {
            QilList result = _f.ActualParameterList();

            result.Add(arg1);
            return(result);
        }
コード例 #12
0
ファイル: InvokeGenerator.cs プロジェクト: Corillian/corefx
        public QilNode GenerateInvoke(QilFunction func, IList<XslNode> actualArgs)
        {
            _iterStack.Clear();
            _formalArgs = func.Arguments;
            _invokeArgs = _fac.ActualParameterList();

            // curArg is an instance variable used in Clone() method
            for (_curArg = 0; _curArg < _formalArgs.Count; _curArg++)
            {
                // Find actual value for a given formal arg
                QilParameter formalArg = (QilParameter)_formalArgs[_curArg];
                QilNode invokeArg = FindActualArg(formalArg, actualArgs);

                // If actual value was not specified, use the default value and copy its debug comment
                if (invokeArg == null)
                {
                    if (_debug)
                    {
                        if (formalArg.Name.NamespaceUri == XmlReservedNs.NsXslDebug)
                        {
                            Debug.Assert(formalArg.Name.LocalName == "namespaces", "Cur,Pos,Last don't have default values and should be always added to by caller in AddImplicitArgs()");
                            Debug.Assert(formalArg.DefaultValue != null, "PrecompileProtoTemplatesHeaders() set it");
                            invokeArg = Clone(formalArg.DefaultValue);
                        }
                        else
                        {
                            invokeArg = _fac.DefaultValueMarker();
                        }
                    }
                    else
                    {
                        Debug.Assert(formalArg.Name.NamespaceUri != XmlReservedNs.NsXslDebug, "Cur,Pos,Last don't have default values and should be always added to by caller in AddImplicitArgs(). We don't have $namespaces in !debug.");
                        invokeArg = Clone(formalArg.DefaultValue);
                    }
                }

                XmlQueryType formalType = formalArg.XmlType;
                XmlQueryType invokeType = invokeArg.XmlType;

                // Possible arg types: anyType, node-set, string, boolean, and number
                _fac.CheckXsltType(formalArg);
                _fac.CheckXsltType(invokeArg);

                if (!invokeType.IsSubtypeOf(formalType))
                {
                    // This may occur only if inferred type of invokeArg is XslFlags.None
                    Debug.Assert(invokeType == T.ItemS, "Actual argument type is not a subtype of formal argument type");
                    invokeArg = _fac.TypeAssert(invokeArg, formalType);
                }

                _invokeArgs.Add(invokeArg);
            }

            // Create Invoke node and wrap it with previous parameter declarations
            QilNode invoke = _fac.Invoke(func, _invokeArgs);
            while (_iterStack.Count != 0)
                invoke = _fac.Loop(_iterStack.Pop(), invoke);

            return invoke;
        }
コード例 #13
0
 public void Reset()
 {
     Debug.Assert(!_inUse);
     _inUse = true;
     _builder.Length = 0;
     _concat = null;
 }
コード例 #14
0
ファイル: QilFactory.cs プロジェクト: pedrobsaila/runtime
        public QilList GlobalParameterList()
        {
            QilList n = new QilList(QilNodeType.GlobalParameterList);

            n.XmlType = QilTypeChecker.CheckGlobalParameterList(n);
            TraceNode(n);
            return(n);
        }
コード例 #15
0
        public QilList ActualParameterList()
        {
            QilList n = new QilList(QilNodeType.ActualParameterList);

            n.XmlType = _typeCheck.CheckActualParameterList(n);
            TraceNode(n);
            return(n);
        }
コード例 #16
0
        public QilList Sequence()
        {
            QilList n = new QilList(QilNodeType.Sequence);

            n.XmlType = this.typeCheck.CheckSequence(n);
            TraceNode(n);
            return(n);
        }
コード例 #17
0
        public QilNode Sequence(QilNode child1, QilNode child2)
        {
            QilList res = _f.Sequence();

            res.Add(child1);
            res.Add(child2);
            return(res);
        }
コード例 #18
0
        public QilList GlobalVariableList()
        {
            QilList n = new QilList(QilNodeType.GlobalVariableList);

            n.XmlType = this.typeCheck.CheckGlobalVariableList(n);
            TraceNode(n);
            return(n);
        }
コード例 #19
0
        public override QilNode ShallowClone(QilFactory f)
        {
            QilList n = (QilList)MemberwiseClone();

            n._members = (QilNode[])_members.Clone();
            f.TraceNode(n);
            return(n);
        }
コード例 #20
0
 public XmlQueryType CheckFormalParameterList(QilList node)
 {
     foreach (QilNode child in node)
     {
         CheckClassAndNodeType(child, typeof(QilParameter), QilNodeType.Parameter);
     }
     return(node.XmlType);
 }
コード例 #21
0
 public XmlQueryType CheckFunctionList(QilList node)
 {
     foreach (QilNode child in node)
     {
         CheckClassAndNodeType(child, typeof(QilFunction), QilNodeType.Function);
     }
     return(node.XmlType);
 }
コード例 #22
0
 public XmlQueryType CheckGlobalVariableList(QilList node)
 {
     foreach (QilNode child in node)
     {
         CheckClassAndNodeType(child, typeof(QilIterator), QilNodeType.Let);
     }
     return(node.XmlType);
 }
コード例 #23
0
        public QilList SortKeyList()
        {
            QilList n = new QilList(QilNodeType.SortKeyList);

            n.XmlType = this.typeCheck.CheckSortKeyList(n);
            TraceNode(n);
            return(n);
        }
コード例 #24
0
        public QilList BranchList()
        {
            QilList n = new QilList(QilNodeType.BranchList);

            n.XmlType = this.typeCheck.CheckBranchList(n);
            TraceNode(n);
            return(n);
        }
コード例 #25
0
        public QilList FunctionList()
        {
            QilList n = new QilList(QilNodeType.FunctionList);

            n.XmlType = this.typeCheck.CheckFunctionList(n);
            TraceNode(n);
            return(n);
        }
コード例 #26
0
        public QilList FormalParameterList()
        {
            QilList n = new QilList(QilNodeType.FormalParameterList);

            n.XmlType = this.typeCheck.CheckFormalParameterList(n);
            TraceNode(n);
            return(n);
        }
コード例 #27
0
 public XmlQueryType CheckSortKeyList(QilList node)
 {
     foreach (QilNode child in node)
     {
         CheckClassAndNodeType(child, typeof(QilSortKey), QilNodeType.SortKey);
     }
     return(node.XmlType);
 }
コード例 #28
0
 private void FlushBuilder() {
     if (concat == null) {
         concat = f.BaseFactory.Sequence();
     }
     if (builder.Length != 0) {
         concat.Add(f.String(builder.ToString()));
         builder.Length = 0;
     }
 }
コード例 #29
0
 public XmlQueryType CheckGlobalParameterList(QilList node)
 {
     foreach (QilNode child in node)
     {
         CheckClassAndNodeType(child, typeof(QilParameter), QilNodeType.Parameter);
         Check(((QilParameter)child).Name != null, child, "Global parameter's name is null");
     }
     return(node.XmlType);
 }
コード例 #30
0
        public QilNode Sequence(QilNode child)
        {
            if (!_debug)
            {
                return(child);
            }
            QilList res = _f.Sequence();

            res.Add(child);
            return(res);
        }
コード例 #31
0
 private void FlushBuilder()
 {
     if (_concat == null)
     {
         _concat = _f.BaseFactory.Sequence();
     }
     if (_builder.Length != 0)
     {
         _concat.Add(_f.String(_builder.ToString()));
         _builder.Length = 0;
     }
 }
コード例 #32
0
        public QilNode Choice(QilNode expr, QilList branches)
        {
            if (!_debug)
            {
                switch (branches.Count)
                {
                case 1:
                    // If expr has no side effects, it will be eliminated by optimizer
                    return(_f.Loop(_f.Let(expr), branches[0]));

                case 2:
                    return(_f.Conditional(_f.Eq(expr, _f.LiteralInt32(0)), branches[0], branches[1]));
                }
            }
            return(_f.Choice(expr, branches));
        }
コード例 #33
0
        public XmlQueryType CheckInvoke(QilInvoke node)
        {
        #if DEBUG
            CheckClassAndNodeType(node[1], typeof(QilList), QilNodeType.ActualParameterList);

            QilList actualArgs = node.Arguments;
            QilList formalArgs = node.Function.Arguments;
            Check(actualArgs.Count == formalArgs.Count, actualArgs, "Invoke argument count must match function's argument count");

            for (int i = 0; i < actualArgs.Count; i++)
            {
                Check(actualArgs[i].XmlType.IsSubtypeOf(formalArgs[i].XmlType), actualArgs[i], "Invoke argument must be a subtype of the invoked function's argument");
            }
        #endif

            return(node.Function.XmlType);
        }
コード例 #34
0
        public QilNode Sequence(params QilNode[] args)
        {
            if (!_debug)
            {
                switch (args.Length)
                {
                case 0: return(_f.Sequence());

                case 1: return(args[0]);
                }
            }
            QilList res = _f.Sequence();

            foreach (QilNode n in args)
            {
                res.Add(n);
            }
            return(res);
        }
コード例 #35
0
        /// <summary>
        /// Create IteratorDescriptor for each global value.  This pre-visit is necessary because a global early
        /// in the list may reference a global later in the list and therefore expect its IteratorDescriptor to already
        /// be initialized.
        /// </summary>
        private void PrepareGlobalValues(QilList globalIterators) {
            MethodInfo methGlobal;
            IteratorDescriptor iterInfo;

            foreach (QilIterator iter in globalIterators) {
                Debug.Assert(iter.NodeType == QilNodeType.Let || iter.NodeType == QilNodeType.Parameter);

                // Get metadata for method which computes this global's value
                methGlobal = XmlILAnnotation.Write(iter).FunctionBinding;
                Debug.Assert(methGlobal != null, "Metadata for global value should have already been computed");

                // Create an IteratorDescriptor for this global value
                iterInfo = new IteratorDescriptor(this.helper);

                // Iterator items will be stored in a global location
                iterInfo.Storage = StorageDescriptor.Global(methGlobal, GetItemStorageType(iter), !iter.XmlType.IsSingleton);

                // Associate IteratorDescriptor with parameter
                XmlILAnnotation.Write(iter).CachedIteratorDescriptor = iterInfo;
            }
        }
コード例 #36
0
 public QilNode Choice(QilNode expr, QilList branches) {
     if (! debug) {
         switch (branches.Count) {
         case 1:
             // If expr has no side effects, it will be eliminated by optimizer
             return f.Loop(f.Let(expr), branches[0]);
         case 2:
             return f.Conditional(f.Eq(expr, f.LiteralInt32(0)), branches[0], branches[1]);
         }
     }
     return f.Choice(expr, branches);
 }
コード例 #37
0
 public QilFunction Function(QilList args, QilNode defn, QilNode sideEffects) {
     Debug.Assert(args.NodeType == QilNodeType.FormalParameterList);
     return f.Function(args, defn, sideEffects, defn.XmlType);
 }
コード例 #38
0
 protected virtual QilNode VisitFormalParameterList(QilList n) { return VisitChildren(n); }
コード例 #39
0
 public XmlQueryType CheckSequence(QilList node) {
     return node.XmlType;
 }
コード例 #40
0
 protected virtual QilNode VisitBranchList(QilList n) { return VisitChildren(n); }
コード例 #41
0
 protected override QilNode VisitGlobalVariableList(QilList n) { return NoReplace(n); }
コード例 #42
0
 protected override QilNode VisitSortKeyList(QilList n) { return NoReplace(n); }
コード例 #43
0
 public XmlQueryType CheckActualParameterList(QilList node) {
     return node.XmlType;
 }
コード例 #44
0
 public XmlQueryType CheckGlobalParameterList(QilList node) {
     foreach (QilNode child in node) {
         CheckClassAndNodeType(child, typeof(QilParameter), QilNodeType.Parameter);
         Check(((QilParameter)child).Name != null, child, "Global parameter's name is null");
     }
     return node.XmlType;
 }
コード例 #45
0
 public XmlQueryType CheckGlobalVariableList(QilList node) {
     foreach (QilNode child in node)
         CheckClassAndNodeType(child, typeof(QilIterator), QilNodeType.Let);
     return node.XmlType;
 }
コード例 #46
0
 public XmlQueryType CheckFunctionList(QilList node) {
     foreach (QilNode child in node)
         CheckClassAndNodeType(child, typeof(QilFunction), QilNodeType.Function);
     return node.XmlType;
 }
コード例 #47
0
 protected virtual QilNode VisitSortKeyList(QilList n) { return VisitChildren(n); }
コード例 #48
0
 public void Reset() {
     Debug.Assert(! inUse);
     inUse = true;
     builder.Length = 0;
     concat = null;
 }
コード例 #49
0
 protected override QilNode VisitFunctionList(QilList n) { return NoReplace(n); }
コード例 #50
0
 protected override QilNode VisitSequence(QilList n) { return NoReplace(n); }
コード例 #51
0
 protected override QilNode VisitBranchList(QilList n) { return NoReplace(n); }
コード例 #52
0
 public XmlQueryType CheckFormalParameterList(QilList node) {
     foreach (QilNode child in node)
         CheckClassAndNodeType(child, typeof(QilParameter), QilNodeType.Parameter);
     return node.XmlType;
 }
コード例 #53
0
 protected override QilNode VisitFormalParameterList(QilList n) { return NoReplace(n); }
コード例 #54
0
 public XmlQueryType CheckSortKeyList(QilList node) {
     foreach (QilNode child in node)
         CheckClassAndNodeType(child, typeof(QilSortKey), QilNodeType.SortKey);
     return node.XmlType;
 }
コード例 #55
0
 public XmlQueryType CheckBranchList(QilList node) {
     return node.XmlType;
 }
コード例 #56
0
 protected virtual QilNode VisitSequence(QilList n) { return VisitChildren(n); }
コード例 #57
0
 //-----------------------------------------------
 // function definition and invocation
 //-----------------------------------------------
 public QilFunction Function(QilList args, QilNode sideEffects, XmlQueryType resultType) {
     Debug.Assert(args.NodeType == QilNodeType.FormalParameterList);
     return f.Function(args, sideEffects, resultType);
 }
コード例 #58
0
 protected virtual QilNode VisitFunctionList(QilList n) { return VisitChildren(n); }
コード例 #59
0
 public QilNode Invoke(QilFunction func, QilList args) {
     Debug.Assert(args.NodeType == QilNodeType.ActualParameterList);
     Debug.Assert(func.Arguments.Count == args.Count);
     return f.Invoke(func, args);
 }
コード例 #60
0
 protected virtual QilNode VisitGlobalVariableList(QilList n) { return VisitChildren(n); }