// Compiles top level expressions
        internal virtual OpcodeBlock Compile(XPathExpr expr)
        {
            Fx.Assert(null != expr, "");

            this.nestingLevel = 1;
            this.pushInitialContext = false;

            XPathExprCompiler exprCompiler = new XPathExprCompiler(this);
            OpcodeBlock mainBlock = exprCompiler.Compile(expr);
            if (this.pushInitialContext)
            {
                OpcodeBlock expandedBlock = new OpcodeBlock();
                expandedBlock.Append(new PushContextNodeOpcode());
                expandedBlock.Append(mainBlock);
                expandedBlock.Append(new PopContextNodes());
                return expandedBlock;
            }
            return mainBlock;
        }
Example #2
0
        // Compiles top level expressions
        internal virtual OpcodeBlock Compile(XPathExpr expr)
        {
            Fx.Assert(null != expr, "");

            this.nestingLevel       = 1;
            this.pushInitialContext = false;

            XPathExprCompiler exprCompiler = new XPathExprCompiler(this);
            OpcodeBlock       mainBlock    = exprCompiler.Compile(expr);

            if (this.pushInitialContext)
            {
                OpcodeBlock expandedBlock = new OpcodeBlock();
                expandedBlock.Append(new PushContextNodeOpcode());
                expandedBlock.Append(mainBlock);
                expandedBlock.Append(new PopContextNodes());
                return(expandedBlock);
            }
            return(mainBlock);
        }
 OpcodeBlock CompileBlock(XPathExpr expr)
 {
     XPathExprCompiler compiler = new XPathExprCompiler(this);
     return compiler.Compile(expr);
 }
Example #4
0
            OpcodeBlock CompileBlock(XPathExpr expr)
            {
                XPathExprCompiler compiler = new XPathExprCompiler(this);

                return(compiler.Compile(expr));
            }