internal void RemoveJump(BlockEndOpcode jumpTo)
 {
     bool flag = base.IsReachableFromConditional();
     if (flag)
     {
         base.prev.DelinkFromConditional(this);
     }
     if (this.jump.ID == OpcodeID.Branch)
     {
         BranchOpcode jump = (BranchOpcode) this.jump;
         jumpTo.DeLinkJump(this);
         jump.RemoveChild(jumpTo);
         if (jump.Branches.Count == 0)
         {
             this.jump = null;
         }
     }
     else
     {
         jumpTo.DeLinkJump(this);
         this.jump = null;
     }
     if (flag && (this.jump != null))
     {
         base.prev.LinkToConditional(this);
     }
 }
 internal virtual void DelinkFromConditional(Opcode child)
 {
     if (this.TestFlag(OpcodeFlags.InConditional))
     {
         ((QueryConditionalBranchOpcode) this.prev).RemoveAlwaysBranch(child);
     }
 }
 internal void AddJump(BlockEndOpcode jumpTo)
 {
     bool flag = base.IsReachableFromConditional();
     if (flag)
     {
         base.prev.DelinkFromConditional(this);
     }
     if (this.jump == null)
     {
         this.jump = jumpTo;
     }
     else
     {
         BranchOpcode jump;
         if (this.jump.ID == OpcodeID.Branch)
         {
             jump = (BranchOpcode) this.jump;
         }
         else
         {
             BlockEndOpcode opcode = (BlockEndOpcode) this.jump;
             jump = new BranchOpcode();
             jump.Branches.Add(opcode);
             this.jump = jump;
         }
         jump.Branches.Add(jumpTo);
     }
     jumpTo.LinkJump(this);
     if (flag && (this.jump != null))
     {
         base.prev.LinkToConditional(this);
     }
 }
 private void AddAlwaysBranch(QueryBranch literalBranch, Opcode next)
 {
     if (OpcodeID.Branch == next.ID)
     {
         BranchOpcode opcode = (BranchOpcode) next;
         OpcodeList branches = opcode.Branches;
         for (int i = 0; i < branches.Count; i++)
         {
             Opcode opcode2 = branches[i];
             if (this.IsAlwaysBranch(opcode2))
             {
                 this.AlwaysBranches.AddInOrder(new QueryBranch(opcode2, literalBranch.ID));
             }
             else
             {
                 opcode2.Flags |= OpcodeFlags.NoContextCopy;
             }
         }
     }
     else if (this.IsAlwaysBranch(next))
     {
         this.AlwaysBranches.AddInOrder(new QueryBranch(next, literalBranch.ID));
     }
     else
     {
         next.Flags |= OpcodeFlags.NoContextCopy;
     }
 }
 internal override void Add(Opcode opcode)
 {
     LiteralRelationOpcode opcode2 = this.ValidateOpcode(opcode);
     if (opcode2 == null)
     {
         base.Add(opcode);
     }
     else
     {
         QueryBranch literalBranch = this.branchIndex[opcode2.Literal];
         if (literalBranch == null)
         {
             this.nextID++;
             literalBranch = new QueryBranch(opcode2, this.nextID);
             opcode2.Prev = this;
             this.branchIndex[opcode2.Literal] = literalBranch;
         }
         else
         {
             literalBranch.Branch.Next.Add(opcode2.Next);
         }
         opcode2.Flags |= OpcodeFlags.InConditional;
         this.AddAlwaysBranch(literalBranch, opcode2.Next);
     }
 }
 internal override void DelinkFromConditional(Opcode child)
 {
     if (base.prev != null)
     {
         base.prev.DelinkFromConditional(child);
     }
 }
 private SubExpr BranchAt(Opcode op, SubExprEliminator elim)
 {
     Opcode firstOp = this.FirstOp;
     if (this.parent != null)
     {
         this.parent.RemoveChild(this);
     }
     else
     {
         elim.Exprs.Remove(this);
     }
     firstOp.DetachFromParent();
     op.DetachFromParent();
     SubExpr expr = new SubExpr(this.parent, firstOp, elim.NewVarID());
     if (this.parent != null)
     {
         this.parent.AddChild(expr);
     }
     else
     {
         elim.Exprs.Add(expr);
     }
     expr.AddChild(this);
     this.parent = expr;
     this.ops = new InternalSubExprOpcode(expr);
     this.ops.Attach(op);
     return expr;
 }
예제 #8
0
 internal override bool Equals(Opcode op)
 {
     if (base.Equals(op))
     {
         return (this.op == ((RelationOpcode)op).op);
     }
     return false;
 }
 internal void AddAlwaysBranch(Opcode literal, Opcode next)
 {
     LiteralRelationOpcode opcode = this.ValidateOpcode(literal);
     if (opcode != null)
     {
         this.AddAlwaysBranch(opcode, next);
     }
 }
 internal override LiteralRelationOpcode ValidateOpcode(Opcode opcode)
 {
     StringEqualsOpcode opcode2 = opcode as StringEqualsOpcode;
     if (opcode2 != null)
     {
         return opcode2;
     }
     return null;
 }
 internal override bool Equals(Opcode opcode)
 {
     if (!base.Equals(opcode))
     {
         return false;
     }
     NumberRelationOpcode opcode2 = (NumberRelationOpcode) opcode;
     return ((opcode2.op == this.op) && (opcode2.literal == this.literal));
 }
예제 #12
0
        // Never used for inverse query, so don't need this
        internal override bool Equals(Opcode op)
        {
            if (base.Equals (op))
            {
                return (this.ordinal == ((LiteralOrdinalOpcode) op).ordinal);
            }

            return false;
        }
 internal override void AddBranch(Opcode opcode)
 {
     this.branches.Add(opcode);
     opcode.Prev = this;
     if (this.IsInConditional())
     {
         this.LinkToConditional(opcode);
     }
 }
 internal override bool Equals(Opcode op)
 {
     if (base.Equals(op))
     {
         NumberEqualsOpcode opcode = (NumberEqualsOpcode) op;
         return (opcode.literal == this.literal);
     }
     return false;
 }
 internal override bool Equals(Opcode op)
 {
     if (base.Equals(op))
     {
         StringPrefixOpcode opcode = (StringPrefixOpcode) op;
         return (opcode.literal == this.literal);
     }
     return false;
 }
 internal override LiteralRelationOpcode ValidateOpcode(Opcode opcode)
 {
     NumberIntervalOpcode opcode2 = opcode as NumberIntervalOpcode;
     if (opcode2 != null)
     {
         return opcode2;
     }
     return null;
 }
예제 #17
0
        internal override bool Equals(Opcode op)
        {
            if (base.Equals(op))
            {
                return (this.mathOp == ((MathOpcode) op).mathOp);
            }

            return false;
        }
 internal Opcode Add(object item, Opcode ops)
 {
     List<SubExpr> list = new List<SubExpr>();
     this.removalMapping.Add(item, list);
     while (ops.Next != null)
     {
         ops = ops.Next;
     }
     Opcode opcode = ops;
     while (ops != null)
     {
         if (IsExprStarter(ops))
         {
             SubExprOpcode opcode4;
             Opcode op = ops;
             Opcode prev = ops.Prev;
             ops.DetachFromParent();
             ops = ops.Next;
             while (ops.ID == OpcodeID.Select)
             {
                 ops = ops.Next;
             }
             ops.DetachFromParent();
             SubExpr expr = null;
             for (int i = 0; i < this.exprList.Count; i++)
             {
                 if (this.exprList[i].FirstOp.Equals(op))
                 {
                     expr = this.exprList[i];
                     break;
                 }
             }
             if (expr == null)
             {
                 expr = new SubExpr(null, op, this.NewVarID());
                 this.exprList.Add(expr);
                 opcode4 = new SubExprOpcode(expr);
             }
             else
             {
                 opcode4 = expr.Add(op, this);
             }
             opcode4.Expr.IncRef();
             list.Add(opcode4.Expr);
             opcode4.Attach(ops);
             ops = opcode4;
             if (prev != null)
             {
                 prev.Attach(ops);
             }
         }
         opcode = ops;
         ops = ops.Prev;
     }
     return opcode;
 }
예제 #19
0
        internal override bool Equals(Opcode op)
        {
            if (base.Equals(op))
            {
                FunctionCallOpcode functionCall = (FunctionCallOpcode)op;
                return functionCall.function.Equals(this.function);
            }

            return false;
        }
 internal Opcode DetachChild()
 {
     Opcode next = this.next;
     if ((next != null) && this.IsInConditional())
     {
         this.DelinkFromConditional(next);
     }
     this.next = null;
     next.prev = null;
     return next;
 }
 internal override bool Equals(Opcode op)
 {
     if (base.Equals(op))
     {
         XPathMessageFunctionCallOpcode opcode = op as XPathMessageFunctionCallOpcode;
         if (opcode != null)
         {
             return (this.function == opcode.function);
         }
     }
     return false;
 }
 internal override bool Equals(Opcode op)
 {
     if (base.Equals(op))
     {
         SubExprOpcode opcode = op as SubExprOpcode;
         if (opcode != null)
         {
             return (this.expr == opcode.expr);
         }
     }
     return false;
 }
 private void Remove(Opcode opcode, object item)
 {
     MultipleResultOpcode opcode2 = opcode as MultipleResultOpcode;
     if (opcode2 != null)
     {
         opcode2.RemoveItem(item);
     }
     else
     {
         opcode.Remove();
     }
 }
 internal override void Add(Opcode opcode)
 {
     for (int i = 0; i < this.branches.Count; i++)
     {
         if (this.branches[i].IsEquivalentForAdd(opcode))
         {
             this.branches[i].Add(opcode);
             return;
         }
     }
     this.AddBranch(opcode);
 }
 internal override void Add(Opcode op)
 {
     MultipleResultOpcode opcode = op as MultipleResultOpcode;
     if (opcode != null)
     {
         this.results.Add(ref opcode.results);
         this.results.TrimToCount();
     }
     else
     {
         base.Add(op);
     }
 }
        internal SubExprOpcode Add(Opcode opseq, SubExprEliminator elim)
        {
            Opcode start = this.FirstOp;
            Opcode ops = opseq;
            while (start != null && ops != null && start.Equals(ops))
            {
                start = start.Next;
                ops = ops.Next;
            }

            if (ops == null)
            {
                if (start == null)
                {
                    return new SubExprOpcode(this);
                }
                else
                {
                    SubExpr e = this.BranchAt(start, elim);
                    return new SubExprOpcode(e);
                }
            }
            else
            {
                if (start == null)
                {
                    ops.DetachFromParent();
                    for (int i = 0; i < this.children.Count; ++i)
                    {
                        if (this.children[i].FirstOp.Equals(ops))
                        {
                            return this.children[i].Add(ops, elim);
                        }
                    }

                    SubExpr e = new SubExpr(this, ops, elim.NewVarID());
                    this.AddChild(e);
                    return new SubExprOpcode(e);
                }
                else
                {
                    SubExpr e = this.BranchAt(start, elim);
                    ops.DetachFromParent();
                    SubExpr ee = new SubExpr(e, ops, elim.NewVarID());
                    e.AddChild(ee);
                    return new SubExprOpcode(ee);
                }
            }
        }
 internal override void Add(Opcode op)
 {
     NumberIntervalOpcode opcode = op as NumberIntervalOpcode;
     if (opcode == null)
     {
         base.Add(op);
     }
     else
     {
         NumberIntervalBranchOpcode with = new NumberIntervalBranchOpcode();
         base.prev.Replace(this, with);
         with.Add(this);
         with.Add(opcode);
     }
 }
 internal override void Add(Opcode op)
 {
     StringPrefixOpcode opcode = op as StringPrefixOpcode;
     if (opcode == null)
     {
         base.Add(op);
     }
     else
     {
         StringPrefixBranchOpcode with = new StringPrefixBranchOpcode();
         base.prev.Replace(this, with);
         with.Add(this);
         with.Add(opcode);
     }
 }
 internal SubExpr(SubExpr parent, Opcode ops, int var)
 {
     this.var = var;
     this.parent = parent;
     this.useSpecial = false;
     if (parent != null)
     {
         this.ops = new InternalSubExprOpcode(parent);
         this.ops.Attach(ops);
         this.useSpecial = (parent is SubExprHeader) && (((SelectOpcode) ops).Criteria.Axis.Type == QueryAxisType.Child);
     }
     else
     {
         this.ops = ops;
     }
 }
 internal static bool IsExprStarter(Opcode op)
 {
     if (op.ID == OpcodeID.SelectRoot)
     {
         return true;
     }
     if (op.ID == OpcodeID.XsltInternalFunction)
     {
         XPathMessageFunctionCallOpcode opcode = (XPathMessageFunctionCallOpcode) op;
         if ((opcode.ReturnType == XPathResultType.NodeSet) && (opcode.ArgCount == 0))
         {
             return true;
         }
     }
     return false;
 }
예제 #31
0
        internal Opcode Select(SeekableXPathNavigator contextNode, NodeSequence destSequence, SelectOpcode next)
        {
            Opcode returnOpcode = next.Next;

            switch (this.type)
            {
            default:
                if (QueryAxisType.Self == this.axis.Type)
                {
                    if (this.MatchType(contextNode) && this.MatchQName(contextNode))
                    {
                        long position = contextNode.CurrentPosition;
                        returnOpcode = next.Eval(destSequence, contextNode);
                        contextNode.CurrentPosition = position;
                    }
                }
                else
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperCritical(new QueryProcessingException(QueryProcessingError.Unexpected));
                }

                break;

            case QueryNodeType.ChildNodes:
                // Select children of arbitrary type off the context node
                if (contextNode.MoveToFirstChild())
                {
                    do
                    {
                        // Select the node if its type and qname matches
                        if (this.MatchType(contextNode) && this.MatchQName(contextNode))
                        {
                            destSequence.Add(contextNode);
                        }
                    }while (contextNode.MoveToNext());
                }
                break;

            case QueryNodeType.Element:
                // Select child elements
                if (contextNode.MoveToFirstChild())
                {
                    do
                    {
                        // Children could have non element nodes in line
                        // Select the node if it is an element and the qname matches
                        if (XPathNodeType.Element == contextNode.NodeType && this.MatchQName(contextNode))
                        {
                            long position = contextNode.CurrentPosition;
                            returnOpcode = next.Eval(destSequence, contextNode);
                            contextNode.CurrentPosition = position;
                        }
                    } while (contextNode.MoveToNext());
                }

                break;

            case QueryNodeType.Root:
                contextNode.MoveToRoot();
                returnOpcode = next.Eval(destSequence, contextNode);
                break;
            }

            return(returnOpcode);
        }
예제 #32
0
 public void Remove(Opcode opcode)
 {
     this.opcodes.Remove(opcode);
 }
 internal override bool Equals(Opcode op)
 {
     return(base.Equals(op) && (((StartBooleanOpcode)op).test == this.test));
 }
예제 #34
0
 public int IndexOf(Opcode opcode)
 {
     return(this.opcodes.IndexOf(opcode));
 }
예제 #35
0
 public void Add(Opcode opcode)
 {
     this.opcodes.Add(opcode);
 }
예제 #36
0
 internal void Attach(Opcode op)
 {
     Fx.Assert(null == this.next, "");
     this.next = op;
     op.prev   = this;
 }
예제 #37
0
 internal virtual bool Equals(Opcode op)
 {
     return(op.ID == this.ID);
 }
예제 #38
0
 internal virtual bool IsEquivalentForAdd(Opcode opcode)
 {
     return(this.ID == opcode.ID);
 }