• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Qil.QilLiteral类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Xml.Xsl.Qil.QilLiteral的典型用法代码示例。如果您正苦于以下问题:C# QilLiteral类的具体用法?C# QilLiteral怎么用?C# QilLiteral使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



QilLiteral类属于System.Xml.Xsl.Qil命名空间,在下文中一共展示了QilLiteral类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FoldArithmetic

        /// <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;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:87,代码来源:xmliloptimizervisitor.cs


示例2: VisitLiteralDecimal

 protected override QilNode VisitLiteralDecimal(QilLiteral n) { return NoReplace(n); }
开发者ID:uQr,项目名称:referencesource,代码行数:1,代码来源:QilPatternVisitor.cs


示例3: CheckLiteralType

 public XmlQueryType CheckLiteralType(QilLiteral node) {
     CheckLiteralValue(node, typeof(XmlQueryType));
     return (XmlQueryType) node;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:4,代码来源:QilTypeChecker.cs


示例4: VisitLiteralString

 /// <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;
 }
开发者ID:Corillian,项目名称:corefx,代码行数:9,代码来源:XmlIlVisitor.cs


示例5: CheckLiteralInt32

 public XmlQueryType CheckLiteralInt32(QilLiteral node) {
     CheckLiteralValue(node, typeof(int));
     return XmlQueryTypeFactory.IntX;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:4,代码来源:QilTypeChecker.cs


示例6: CheckLiteralDouble

 public XmlQueryType CheckLiteralDouble(QilLiteral node) {
     CheckLiteralValue(node, typeof(double));
     return XmlQueryTypeFactory.DoubleX;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:4,代码来源:QilTypeChecker.cs


示例7: LiteralInt64

 public QilLiteral LiteralInt64(long value) {
     QilLiteral n = new QilLiteral(QilNodeType.LiteralInt64, value);
     n.XmlType = this.typeCheck.CheckLiteralInt64(n);
     TraceNode(n);
     return n;
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:6,代码来源:QilFactory.cs


示例8: VisitLiteralObject

 protected virtual QilNode VisitLiteralObject(QilLiteral n) { return VisitChildren(n); }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:1,代码来源:QilVisitor.cs


示例9: VisitLiteralDecimal

 /// <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;
 }
开发者ID:Corillian,项目名称:corefx,代码行数:9,代码来源:XmlIlVisitor.cs


示例10: LiteralString

 public QilLiteral LiteralString(string value) {
     QilLiteral n = new QilLiteral(QilNodeType.LiteralString, value);
     n.XmlType = this.typeCheck.CheckLiteralString(n);
     TraceNode(n);
     return n;
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:6,代码来源:QilFactory.cs


示例11: VisitLiteralDouble

 /// <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;
 }
开发者ID:Corillian,项目名称:corefx,代码行数:9,代码来源:XmlIlVisitor.cs


示例12: VisitLiteralInt64

 /// <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;
 }
开发者ID:Corillian,项目名称:corefx,代码行数:9,代码来源:XmlIlVisitor.cs


示例13: VisitLiteralInt32

 /// <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;
 }
开发者ID:Corillian,项目名称:corefx,代码行数:9,代码来源:XmlIlVisitor.cs


示例14: VisitLiteralObject

 protected override QilNode VisitLiteralObject(QilLiteral n) { return NoReplace(n); }
开发者ID:uQr,项目名称:referencesource,代码行数:1,代码来源:QilPatternVisitor.cs


示例15: LiteralDouble

 public QilLiteral LiteralDouble(double value) {
     QilLiteral n = new QilLiteral(QilNodeType.LiteralDouble, value);
     n.XmlType = this.typeCheck.CheckLiteralDouble(n);
     TraceNode(n);
     return n;
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:6,代码来源:QilFactory.cs


示例16: VisitLiteralDecimal

 protected virtual QilNode VisitLiteralDecimal(QilLiteral n) { return VisitChildren(n); }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:1,代码来源:QilVisitor.cs


示例17: LiteralDecimal

 public QilLiteral LiteralDecimal(decimal value) {
     QilLiteral n = new QilLiteral(QilNodeType.LiteralDecimal, value);
     n.XmlType = this.typeCheck.CheckLiteralDecimal(n);
     TraceNode(n);
     return n;
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:6,代码来源:QilFactory.cs


示例18: CheckLiteralString

 public XmlQueryType CheckLiteralString(QilLiteral node) {
     CheckLiteralValue(node, typeof(string));
     return XmlQueryTypeFactory.StringX;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:4,代码来源:QilTypeChecker.cs


示例19: LiteralType

 public QilLiteral LiteralType(XmlQueryType value) {
     QilLiteral n = new QilLiteral(QilNodeType.LiteralType, value);
     n.XmlType = this.typeCheck.CheckLiteralType(n);
     TraceNode(n);
     return n;
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:6,代码来源:QilFactory.cs


示例20: CheckLiteralInt64

 public XmlQueryType CheckLiteralInt64(QilLiteral node) {
     CheckLiteralValue(node, typeof(long));
     return XmlQueryTypeFactory.IntegerX;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:4,代码来源:QilTypeChecker.cs



注:本文中的System.Xml.Xsl.Qil.QilLiteral类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Qil.QilUnary类代码示例发布时间:2022-05-26
下一篇:
C# Qil.QilList类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap