コード例 #1
0
        public virtual ASTNode Fold(ASTNode node, params Object[] args)
        {
            // Protection. JustInCase™
            if (node == null)
            {
                return(null);
            }

            this.FoldNode(node, args);
            ASTNode ret = this.InternalNodeFoldFunc(node, args);

            // We may want to remove a node
            if (ret == null)
            {
                node.Parent.RemoveChild(node);
            }
            else if (!node.Equals(ret) && node.Parent != null)
            {
                node.ReplaceInParent(ret);
            }

            return(ret);
        }