View over a Qil atomic value literal (of any type).
Don't construct QIL nodes directly; instead, use the QilFactory.
Inheritance: QilNode
コード例 #1
0
        public QilLiteral LiteralInt64(long value)
        {
            QilLiteral n = new QilLiteral(QilNodeType.LiteralInt64, value);

            n.XmlType = this.typeCheck.CheckLiteralInt64(n);
            TraceNode(n);
            return(n);
        }
コード例 #2
0
        public QilLiteral LiteralDouble(double value)
        {
            QilLiteral n = new QilLiteral(QilNodeType.LiteralDouble, value);

            n.XmlType = this.typeCheck.CheckLiteralDouble(n);
            TraceNode(n);
            return(n);
        }
コード例 #3
0
        public QilLiteral LiteralInt32(int value)
        {
            QilLiteral n = new QilLiteral(QilNodeType.LiteralInt32, value);

            n.XmlType = _typeCheck.CheckLiteralInt32(n);
            TraceNode(n);
            return(n);
        }
コード例 #4
0
        public QilLiteral LiteralString(string value)
        {
            QilLiteral n = new QilLiteral(QilNodeType.LiteralString, value);

            n.XmlType = this.typeCheck.CheckLiteralString(n);
            TraceNode(n);
            return(n);
        }
コード例 #5
0
        public QilLiteral LiteralDecimal(decimal value)
        {
            QilLiteral n = new QilLiteral(QilNodeType.LiteralDecimal, value);

            n.XmlType = this.typeCheck.CheckLiteralDecimal(n);
            TraceNode(n);
            return(n);
        }
コード例 #6
0
        public QilLiteral LiteralObject(object value)
        {
            QilLiteral n = new QilLiteral(QilNodeType.LiteralObject, value);

            n.XmlType = this.typeCheck.CheckLiteralObject(n);
            TraceNode(n);
            return(n);
        }
コード例 #7
0
        public QilLiteral LiteralType(XmlQueryType value)
        {
            QilLiteral n = new QilLiteral(QilNodeType.LiteralType, value);

            n.XmlType = this.typeCheck.CheckLiteralType(n);
            TraceNode(n);
            return(n);
        }
コード例 #8
0
ファイル: XmlIlVisitor.cs プロジェクト: Corillian/corefx
 /// <summary>
 /// Generate code for QilNodeType.LiteralDouble.
 /// </summary>
 protected override QilNode VisitLiteralDouble(QilLiteral ndDbl)
 {
     _helper.Emit(OpCodes.Ldc_R8, (double)ndDbl);
     _iterCurr.Storage = StorageDescriptor.Stack(typeof(double), false);
     return ndDbl;
 }
コード例 #9
0
 public XmlQueryType CheckLiteralDouble(QilLiteral node) {
     CheckLiteralValue(node, typeof(double));
     return XmlQueryTypeFactory.DoubleX;
 }
コード例 #10
0
 public XmlQueryType CheckLiteralInt32(QilLiteral node) {
     CheckLiteralValue(node, typeof(int));
     return XmlQueryTypeFactory.IntX;
 }
コード例 #11
0
 protected virtual QilNode VisitLiteralObject(QilLiteral n) { return VisitChildren(n); }
コード例 #12
0
 public XmlQueryType CheckLiteralObject(QilLiteral node)
 {
     Check(node.Value != null, node, "Literal value is null");
     return(XmlQueryTypeFactory.ItemS);
 }
コード例 #13
0
 public QilLiteral LiteralType(XmlQueryType value) {
     QilLiteral n = new QilLiteral(QilNodeType.LiteralType, value);
     n.XmlType = this.typeCheck.CheckLiteralType(n);
     TraceNode(n);
     return n;
 }
コード例 #14
0
 public QilLiteral LiteralDecimal(decimal value) {
     QilLiteral n = new QilLiteral(QilNodeType.LiteralDecimal, value);
     n.XmlType = this.typeCheck.CheckLiteralDecimal(n);
     TraceNode(n);
     return n;
 }
コード例 #15
0
 public QilLiteral LiteralDouble(double value) {
     QilLiteral n = new QilLiteral(QilNodeType.LiteralDouble, value);
     n.XmlType = this.typeCheck.CheckLiteralDouble(n);
     TraceNode(n);
     return n;
 }
コード例 #16
0
 public QilLiteral LiteralInt64(long value) {
     QilLiteral n = new QilLiteral(QilNodeType.LiteralInt64, value);
     n.XmlType = this.typeCheck.CheckLiteralInt64(n);
     TraceNode(n);
     return n;
 }
コード例 #17
0
 public QilLiteral LiteralString(string value) {
     QilLiteral n = new QilLiteral(QilNodeType.LiteralString, value);
     n.XmlType = this.typeCheck.CheckLiteralString(n);
     TraceNode(n);
     return n;
 }
コード例 #18
0
ファイル: XmlIlVisitor.cs プロジェクト: Corillian/corefx
 /// <summary>
 /// Generate code for QilNodeType.LiteralDecimal.
 /// </summary>
 protected override QilNode VisitLiteralDecimal(QilLiteral ndDec)
 {
     _helper.ConstructLiteralDecimal((decimal)ndDec);
     _iterCurr.Storage = StorageDescriptor.Stack(typeof(decimal), false);
     return ndDec;
 }
コード例 #19
0
 public XmlQueryType CheckLiteralInt64(QilLiteral node)
 {
     CheckLiteralValue(node, typeof(long));
     return(XmlQueryTypeFactory.IntegerX);
 }
コード例 #20
0
 public XmlQueryType CheckLiteralDecimal(QilLiteral node)
 {
     CheckLiteralValue(node, typeof(decimal));
     return(XmlQueryTypeFactory.DecimalX);
 }
コード例 #21
0
 public QilLiteral LiteralObject(object value) {
     QilLiteral n = new QilLiteral(QilNodeType.LiteralObject, value);
     n.XmlType = this.typeCheck.CheckLiteralObject(n);
     TraceNode(n);
     return n;
 }
コード例 #22
0
ファイル: XmlIlVisitor.cs プロジェクト: Corillian/corefx
 /// <summary>
 /// Generate code for QilNodeType.LiteralInt32.
 /// </summary>
 protected override QilNode VisitLiteralInt32(QilLiteral ndInt)
 {
     _helper.LoadInteger((int)ndInt);
     _iterCurr.Storage = StorageDescriptor.Stack(typeof(int), false);
     return ndInt;
 }
コード例 #23
0
 /// <summary>
 /// Return true if arithmetic operation "opType" can be computed over two literal operands without causing
 /// an overflow or divide by zero exception.
 /// </summary>
 private bool CanFoldArithmetic(QilNodeType opType, QilLiteral left, QilLiteral right) {
     return (FoldArithmetic(opType, left, right) is QilLiteral);
 }
コード例 #24
0
        /// <summary>
        /// Compute the arithmetic operation "opType" over two literal operands and return the result as a QilLiteral.
        /// Arithmetic operations are always checked; in the case of an overflow or divide by zero exception, return
        /// the unfolded result.
        /// </summary>
        private QilNode FoldArithmetic(QilNodeType opType, QilLiteral left, QilLiteral right) {
            Debug.Assert(left.NodeType == right.NodeType);

            // Catch any overflow or divide by zero exceptions
            try {
                checked {
                    switch (left.NodeType) {
                        case QilNodeType.LiteralInt32: {
                            int intLeft = left;
                            int intRight = right;

                            switch (opType) {
                                case QilNodeType.Add: return f.LiteralInt32(intLeft + intRight);
                                case QilNodeType.Subtract: return f.LiteralInt32(intLeft - intRight);
                                case QilNodeType.Multiply: return f.LiteralInt32(intLeft * intRight);
                                case QilNodeType.Divide: return f.LiteralInt32(intLeft / intRight);
                                case QilNodeType.Modulo: return f.LiteralInt32(intLeft % intRight);
                            }
                            break;
                        }

                        case QilNodeType.LiteralInt64: {
                            long lngLeft = left;
                            long lngRight = right;

                            switch (opType) {
                                case QilNodeType.Add: return f.LiteralInt64(lngLeft + lngRight);
                                case QilNodeType.Subtract: return f.LiteralInt64(lngLeft - lngRight);
                                case QilNodeType.Multiply: return f.LiteralInt64(lngLeft * lngRight);
                                case QilNodeType.Divide: return f.LiteralInt64(lngLeft / lngRight);
                                case QilNodeType.Modulo: return f.LiteralInt64(lngLeft % lngRight);
                            }
                            break;
                        }

                        case QilNodeType.LiteralDecimal: {
                            decimal lngLeft = left;
                            decimal lngRight = right;

                            switch (opType) {
                                case QilNodeType.Add: return f.LiteralDecimal(lngLeft + lngRight);
                                case QilNodeType.Subtract: return f.LiteralDecimal(lngLeft - lngRight);
                                case QilNodeType.Multiply: return f.LiteralDecimal(lngLeft * lngRight);
                                case QilNodeType.Divide: return f.LiteralDecimal(lngLeft / lngRight);
                                case QilNodeType.Modulo: return f.LiteralDecimal(lngLeft % lngRight);
                            }
                            break;
                        }

                        case QilNodeType.LiteralDouble: {
                            double lngLeft = left;
                            double lngRight = right;

                            switch (opType) {
                                case QilNodeType.Add: return f.LiteralDouble(lngLeft + lngRight);
                                case QilNodeType.Subtract: return f.LiteralDouble(lngLeft - lngRight);
                                case QilNodeType.Multiply: return f.LiteralDouble(lngLeft * lngRight);
                                case QilNodeType.Divide: return f.LiteralDouble(lngLeft / lngRight);
                                case QilNodeType.Modulo: return f.LiteralDouble(lngLeft % lngRight);
                            }
                            break;
                        }
                    }
                }
            }
            catch (OverflowException) {
            }
            catch (DivideByZeroException) {
            }

            // An error occurred, so don't fold operationo
            switch (opType) {
                case QilNodeType.Add: return f.Add(left, right);
                case QilNodeType.Subtract: return f.Subtract(left, right);
                case QilNodeType.Multiply: return f.Multiply(left, right);
                case QilNodeType.Divide: return f.Divide(left, right);
                case QilNodeType.Modulo: return f.Modulo(left, right);
            }

            Debug.Assert(false, "Cannot fold this arithmetic operation: " + opType);
            return null;
        }
コード例 #25
0
 protected override QilNode VisitLiteralDecimal(QilLiteral n)
 {
     return(NoReplace(n));
 }
コード例 #26
0
 protected virtual QilNode VisitLiteralDecimal(QilLiteral n) { return VisitChildren(n); }
コード例 #27
0
 protected override QilNode VisitLiteralObject(QilLiteral n)
 {
     return(NoReplace(n));
 }
コード例 #28
0
 public XmlQueryType CheckLiteralString(QilLiteral node) {
     CheckLiteralValue(node, typeof(string));
     return XmlQueryTypeFactory.StringX;
 }
コード例 #29
0
 public XmlQueryType CheckLiteralType(QilLiteral node) {
     CheckLiteralValue(node, typeof(XmlQueryType));
     return (XmlQueryType) node;
 }
コード例 #30
0
 public XmlQueryType CheckLiteralInt64(QilLiteral node) {
     CheckLiteralValue(node, typeof(long));
     return XmlQueryTypeFactory.IntegerX;
 }
コード例 #31
0
 public XmlQueryType CheckLiteralString(QilLiteral node)
 {
     CheckLiteralValue(node, typeof(string));
     return(XmlQueryTypeFactory.StringX);
 }
コード例 #32
0
 public XmlQueryType CheckLiteralDecimal(QilLiteral node) {
     CheckLiteralValue(node, typeof(decimal));
     return XmlQueryTypeFactory.DecimalX;
 }
コード例 #33
0
ファイル: XmlIlVisitor.cs プロジェクト: Corillian/corefx
 /// <summary>
 /// Generate code for QilNodeType.LiteralInt64.
 /// </summary>
 protected override QilNode VisitLiteralInt64(QilLiteral ndLong)
 {
     _helper.Emit(OpCodes.Ldc_I8, (long)ndLong);
     _iterCurr.Storage = StorageDescriptor.Stack(typeof(long), false);
     return ndLong;
 }
コード例 #34
0
 public XmlQueryType CheckLiteralObject(QilLiteral node) {
     Check(node.Value != null, node, "Literal value is null");
     return XmlQueryTypeFactory.ItemS;
 }
コード例 #35
0
 protected override QilNode VisitLiteralDecimal(QilLiteral n) { return NoReplace(n); }
コード例 #36
0
 public XmlQueryType CheckLiteralInt32(QilLiteral node)
 {
     CheckLiteralValue(node, typeof(int));
     return(XmlQueryTypeFactory.IntX);
 }
コード例 #37
0
 protected override QilNode VisitLiteralObject(QilLiteral n) { return NoReplace(n); }
コード例 #38
0
 public XmlQueryType CheckLiteralDouble(QilLiteral node)
 {
     CheckLiteralValue(node, typeof(double));
     return(XmlQueryTypeFactory.DoubleX);
 }
コード例 #39
0
 protected virtual QilNode VisitLiteralDecimal(QilLiteral n)
 {
     return(VisitChildren(n));
 }
コード例 #40
0
 public XmlQueryType CheckLiteralType(QilLiteral node)
 {
     CheckLiteralValue(node, typeof(XmlQueryType));
     return((XmlQueryType)node);
 }
コード例 #41
0
ファイル: QilFactory.cs プロジェクト: geoffkizer/corefx
 public QilLiteral LiteralInt32(int value)
 {
     QilLiteral n = new QilLiteral(QilNodeType.LiteralInt32, value);
     n.XmlType = _typeCheck.CheckLiteralInt32(n);
     TraceNode(n);
     return n;
 }
コード例 #42
0
 /// <summary>
 /// Serialize literal types using either "S" or "G" formatting, depending on the option which has been set.
 /// </summary>
 protected override QilNode VisitLiteralType(QilLiteral value)
 {
     this.writer.WriteString(((XmlQueryType)value).ToString((this.options & Options.TypeInfo) != 0 ? "G" : "S"));
     return(value);
 }
コード例 #43
0
ファイル: XmlIlVisitor.cs プロジェクト: Corillian/corefx
 /// <summary>
 /// Generate code for QilNodeType.LiteralString.
 /// </summary>
 protected override QilNode VisitLiteralString(QilLiteral ndStr)
 {
     _helper.Emit(OpCodes.Ldstr, (string)ndStr);
     _iterCurr.Storage = StorageDescriptor.Stack(typeof(string), false);
     return ndStr;
 }
コード例 #44
0
 protected virtual QilNode VisitLiteralObject(QilLiteral n)
 {
     return(VisitChildren(n));
 }
コード例 #45
0
ファイル: QilPatternVisitor.cs プロジェクト: zouql/runtime
 protected override QilNode VisitLiteralType(QilLiteral n) { return NoReplace(n); }