当前位置: 首页>>代码示例>>C#>>正文


C# BinaryOperator.ReplaceChild方法代码示例

本文整理汇总了C#中BinaryOperator.ReplaceChild方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryOperator.ReplaceChild方法的具体用法?C# BinaryOperator.ReplaceChild怎么用?C# BinaryOperator.ReplaceChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BinaryOperator的用法示例。


在下文中一共展示了BinaryOperator.ReplaceChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RotateFromRight

        /// <summary>
        /// We have determined that our right-hand operand is another binary operator, and its
        /// left-hand operand is a constant that can be combined with our left-hand operand.
        /// Now we want to set the left-hand operand of that other operator to the newly-
        /// combined constant value, and then rotate it up -- replace our binary operator
        /// with this newly-modified binary operator, and then attempt to re-evaluate it.
        /// </summary>
        /// <param name="binaryOp">the binary operator that is our right-hand operand</param>
        /// <param name="newLiteral">the newly-combined literal</param>
        private void RotateFromRight(BinaryOperator node, BinaryOperator binaryOp, ConstantWrapper newLiteral)
        {
            // replace our node with the binary operator
            binaryOp.ReplaceChild(binaryOp.Operand1, newLiteral);
            node.Parent.ReplaceChild(node, binaryOp);

            // and just for good measure.. revisit the node that's taking our place, since
            // we just changed a constant value. Assuming the other operand is a constant, too.
            ConstantWrapper otherConstant = binaryOp.Operand2 as ConstantWrapper;
            if (otherConstant != null)
            {
                EvalThisOperator(binaryOp, newLiteral, otherConstant);
            }
        }
开发者ID:nuxleus,项目名称:ajaxmin,代码行数:23,代码来源:EvaluateLiteralVisitor.cs


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