Ejemplo n.º 1
0
        protected override IAstTreeNode Xform(ExpressionNode node)
        {
            foreach (var child in node.Children)
            {
                var childExpression = child as ExpressionNode;

                if (childExpression != null &&
                    node.OpCode == childExpression.OpCode &&
                    node.GetArity() == Arity.BinaryPlus)
                {
                    var clone = (ExpressionNode)node.Clone();
                    clone.Children.RemoveAll(cchild => cchild.Id == child.Id);
                    clone.Children.AddRange(child.Children);
                    return clone;
                }
            }

            return null;
        }