Esempio n. 1
0
SgNode* SgNode::CopyTree() const
{
    SgNode* newNode = new SgNode();
    if (newNode)
    {
        newNode->CopyAllPropsFrom(*this);
        CopySubtree(this, newNode);
    }
    return newNode;
}
Esempio n. 2
0
void SgNode::CopySubtree(const SgNode* node, SgNode* copy)
{
    for (const SgNode* son = node->LeftMostSon(); son;
            son = son->RightBrother())
    {
        SgNode* sonCopy = copy->NewRightMostSon();
        sonCopy->CopyAllPropsFrom(*son);
        CopySubtree(son, sonCopy);
    }
}