Ejemplo n.º 1
0
Branch* find_enclosing_for_loop_contents(Term* term)
{
    Term* loop = find_enclosing_for_loop(term);
    if (loop == NULL)
        return NULL;
    return nested_contents(loop);
}
Ejemplo n.º 2
0
bool enclosing_loop_produces_output_value(Term* term)
{
    Term* enclosingForLoop = find_enclosing_for_loop(term);
    if (enclosingForLoop == NULL)
        return false;
    return loop_produces_output_value(enclosingForLoop);
}
Ejemplo n.º 3
0
void index_func_postCompile(Term* term)
{
    Term* enclosingLoop = find_enclosing_for_loop(term);
    if (enclosingLoop == NULL)
        return;
    Term* loop_index = for_loop_find_index(nested_contents(enclosingLoop));
    if (loop_index == NULL)
        return;
    set_input(term, 0, loop_index);
    set_input_hidden(term, 0, true);
}
Ejemplo n.º 4
0
Term* find_enclosing_for_loop(Term* term)
{
    if (term == NULL)
        return NULL;

    if (term->function == FUNCS.for_func)
        return term;

    Branch* branch = term->owningBranch;
    if (branch == NULL)
        return NULL;

    return find_enclosing_for_loop(branch->owningTerm);
}