internal override Opcode Eval(ProcessingContext context)
        {
            XPathResult result;
            StackFrame topArg = context.TopArg;
            switch (context.Values[topArg.basePtr].Type)
            {
                case ValueDataType.Boolean:
                    result = new XPathResult(context.Values[topArg.basePtr].GetBoolean());
                    break;

                case ValueDataType.Double:
                    result = new XPathResult(context.Values[topArg.basePtr].GetDouble());
                    break;

                case ValueDataType.Sequence:
                {
                    SafeNodeSequenceIterator nodeSetResult = new SafeNodeSequenceIterator(context.Values[topArg.basePtr].GetSequence(), context);
                    result = new XPathResult(nodeSetResult);
                    break;
                }
                case ValueDataType.String:
                    result = new XPathResult(context.Values[topArg.basePtr].GetString());
                    break;

                default:
                    throw Fx.AssertAndThrow("Unexpected result type.");
            }
            context.Processor.QueryResult = result;
            context.PopFrame();
            return base.next;
        }
        internal override Opcode Eval(ProcessingContext context)
        {
            XPathResult result;
            StackFrame topArg = context.TopArg;
            switch (context.Values[topArg.basePtr].Type)
            {
                case ValueDataType.Boolean:
                    result = new XPathResult(context.Values[topArg.basePtr].GetBoolean());
                    break;

                case ValueDataType.Double:
                    result = new XPathResult(context.Values[topArg.basePtr].GetDouble());
                    break;

                case ValueDataType.Sequence:
                {
                    SafeNodeSequenceIterator nodeSetResult = new SafeNodeSequenceIterator(context.Values[topArg.basePtr].GetSequence(), context);
                    result = new XPathResult(nodeSetResult);
                    break;
                }
                case ValueDataType.String:
                    result = new XPathResult(context.Values[topArg.basePtr].GetString());
                    break;

                default:
                    throw Fx.AssertAndThrow("Unexpected result type.");
            }
            context.Processor.ResultSet.Add(new KeyValuePair<MessageQuery, XPathResult>((MessageQuery) this.results[0], result));
            for (int i = 1; i < this.results.Count; i++)
            {
                context.Processor.ResultSet.Add(new KeyValuePair<MessageQuery, XPathResult>((MessageQuery) this.results[i], result.Copy()));
            }
            context.PopFrame();
            return base.next;
        }
예제 #3
0
        internal override Opcode Eval(ProcessingContext context)
        {
            StackFrame topFrame = context.TopArg;
            ValueDataType resultType = context.Values[topFrame.basePtr].Type;
            XPathResult result;

            switch (resultType)
            {
                case ValueDataType.Sequence:
                    {
                        SafeNodeSequenceIterator value = new SafeNodeSequenceIterator(context.Values[topFrame.basePtr].GetSequence(), context);
                        result = new XPathResult(value);
                    }
                    break;
                case ValueDataType.Boolean:
                    {
                        bool value = context.Values[topFrame.basePtr].GetBoolean();
                        result = new XPathResult(value);
                    }
                    break;
                case ValueDataType.String:
                    {
                        string value = context.Values[topFrame.basePtr].GetString();
                        result = new XPathResult(value);
                    }
                    break;
                case ValueDataType.Double:
                    {
                        double value = context.Values[topFrame.basePtr].GetDouble();
                        result = new XPathResult(value);
                    }
                    break;
                default:
                    throw Fx.AssertAndThrow("Unexpected result type.");
            }

            context.Processor.QueryResult = result;
            context.PopFrame();
            return this.next;       
        }
예제 #4
0
        internal override Opcode Eval(ProcessingContext context)
        {
            Fx.Assert(this.results.Count > 0, "QueryMultipleQueryResultOpcode in the eval tree but no query present");
            Fx.Assert(context.Processor.ResultSet != null, "QueryMultipleQueryResultOpcode should only be used in eval cases");

            StackFrame topFrame = context.TopArg;
            ValueDataType resultType = context.Values[topFrame.basePtr].Type;
            XPathResult result;

            switch (resultType)
            {
                case ValueDataType.Sequence:
                    {
                        SafeNodeSequenceIterator value = new SafeNodeSequenceIterator(context.Values[topFrame.basePtr].GetSequence(), context);
                        result = new XPathResult(value);
                    }
                    break;
                case ValueDataType.Boolean:
                    {
                        bool value = context.Values[topFrame.basePtr].GetBoolean();
                        result = new XPathResult(value);
                    }
                    break;
                case ValueDataType.String:
                    {
                        string value = context.Values[topFrame.basePtr].GetString();
                        result = new XPathResult(value);
                    }
                    break;
                case ValueDataType.Double:
                    {
                        double value = context.Values[topFrame.basePtr].GetDouble();
                        result = new XPathResult(value);
                    }
                    break;
                default:
                    throw Fx.AssertAndThrow("Unexpected result type.");
            }

            context.Processor.ResultSet.Add(new KeyValuePair<MessageQuery, XPathResult>((MessageQuery)this.results[0], result));

            for (int i = 1; i < this.results.Count; i++)
            {
                context.Processor.ResultSet.Add(new KeyValuePair<MessageQuery, XPathResult>((MessageQuery)this.results[i], result.Copy()));
            }

            context.PopFrame();
            return this.next;
        }