Пример #1
0
std::string get_relative_name_at(Term* location, Term* term)
{
    if (location->owningBlock == NULL)
        return term->name();
    else
        return get_relative_name(location->owningBlock, term);
}
Пример #2
0
// Returns the corresponding term inside newBranch, if found.
// Returns 'term' if the translation does not apply (term is not found inside
// oldBranch).
// Returns NULL if the translation does apply, but a corresponding term cannot be found.
Term* translate_term_across_branches(Term* term, Branch* oldBranch, Branch* newBranch)
{
    if (!term_is_child_of_branch(term, oldBranch))
        return term;

    Value relativeName;
    get_relative_name(term, oldBranch, &relativeName);
    return find_from_relative_name(&relativeName, newBranch);
}